本文整理汇总了C++中Info类的典型用法代码示例。如果您正苦于以下问题:C++ Info类的具体用法?C++ Info怎么用?C++ Info使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: children
void ClientConnection::createCharacter(const RootOperation& op)
{
static unsigned int charCounter = 0;
char charId[64];
::snprintf(charId, 64, "_customChar_%d", ++charCounter);
RootEntity ent = smart_dynamic_cast<RootEntity>(op->getArgs().front());
ent->setId(charId);
ent->setLoc("_world");
m_server->m_world[charId] = ent;
StringList children(m_server->m_world["_world"]->getContains());
children.push_back(charId);
m_server->m_world["_world"]->setContains(children);
Agent* ag = new Agent(this, charId);
ag->setEntityVisible(charId, true);
m_agents[charId] = ag;
Info info;
info->setArgs1(m_server->m_world[charId]);
info->setFrom(charId);
info->setTo(m_account); // I *think* this is right
info->setRefno(op->getSerialno());
send(info);
}
示例2:
const EnvironmentGroup::Info EnvironmentGroup::getDefaultEnvironment () const
{
Info rfgi;
rfgi.setFamilyId(0);
return rfgi;
}
示例3: sendError
void ClientConnection::activateCharacter(const std::string& charId, const RootOperation& op)
{
// special magic testing IDs
if (charId == "_fail_") {
sendError("deliberate", op);
return;
}
assert(entityIsCharacter(charId));
//debug() << "activation, inbound op's serial is " << op->getSerialno();
if (m_agents.count(charId)) {
sendError("duplicate character action", op);
return;
}
Agent* ag = new Agent(this, charId);
m_agents[charId] = ag;
Info info;
info->setArgs1(m_server->m_world[charId]);
info->setFrom(charId);
info->setTo(m_account); // I *think* this is right
info->setRefno(op->getSerialno());
send(info);
ag->processOp(op); // process as normal
}
示例4: main
int main() {
Info info;
cout << info.getType() << endl;
cout << info.getName() << endl;
cout << is_rvalue_reference<string&&>::value << endl;
return 0;
}
示例5: Peer
void Juncture::onSocketConnected()
{
m_peer = new Peer(*m_socket, m_connection->m_server,
m_host, m_port, getId(), getIntId());
m_socket->setup(m_peer);
m_peer->destroyed.connect(sigc::mem_fun(this, &Juncture::onPeerLost));
m_peer->replied.connect(sigc::mem_fun(this, &Juncture::onPeerReplied));
log(INFO, String::compose("Juncture onPeerC succeeded %1", getId()));
if (m_connection != 0) {
Anonymous info_arg;
addToEntity(info_arg);
Info info;
info->setArgs1(info_arg);
if (m_connectRef != 0L) {
info->setRefno(m_connectRef);
}
m_connection->send(info);
}
m_socket = 0;
m_connectRef = 0L;
}
示例6: send
void ClientConnection::processAnonymousGet(const Get& get)
{
const std::vector<Root>& args = get->getArgs();
if (args.empty())
{
Info serverInfo;
RootEntity svObj;
Atlas::Message::ListType prs;
prs.push_back("server");
svObj->setParentsAsList(prs);
svObj->setName("Bob's StubServer");
svObj->setAttr("server", "stubserver");
svObj->setAttr("ruleset", "stub-world");
svObj->setAttr("uptime", 666.0);
svObj->setAttr("clients", 42);
serverInfo->setArgs1(svObj);
send(serverInfo);
} else {
std::string typeName = args.front()->getId();
if (m_server->m_types.count(typeName))
{
Info typeInfo;
typeInfo->setArgs1(m_server->m_types[typeName]);
typeInfo->setRefno(get->getSerialno());
send(typeInfo);
} else
sendError("unknown type " + typeName, get);
}
}
示例7: ERR_FATAL
//
// DTrack::RegisterDestruction
//
// Register the destruction of the item 'info'
//
void DTrack::RegisterDestruction(Info &info)
{
// Never registered, or has died - perhaps deleting twice?
if (!info.IsSetup())
{
ERR_FATAL(("Invalid destruction : Item is NOT setup! (Tracker %s)", name.str));
}
// Different id, something bad has happened - perhaps bad memory?
if (*info.trackPos != info.id)
{
ERR_FATAL(("Invalid destruction : Different Id (Tracker %s, %d, %d)", name.str, *info.trackPos, info.id));
}
// Set item as empty
*info.trackPos = DTRACK_EMPTY;
// Add to cache
CacheAdd(info.trackPos);
// Info is no longer setup
info.Clear();
ASSERT(stateInfo.items);
// Decrease number of items
stateInfo.items--;
}
示例8: main
int main(int argc, char** argv) {
TestBox t;
MidiInfo minf("midifiles/Cisei.kar"); //open file (open initialize also ticklength of file, resolution.....)
if(minf.isValid())
minf.readInfo(&t); //if you have a valid midi, read all info filling t
else
return ERR_NOTMIDI;
minf.readInfo(); //now try to call readInfo without parameters. What happens? Nothing special but..
Tick* inf = minf.getInfo();//you can use defaul struct Tick
Info *n = inf[22320].info;
unsigned char* buf;
while((n != NULL) && (buf = n->nextInfo()))
printf("\nInfo :%s", buf);
printf("\n\nNumber of ticks: %d Resolution: %dtpb Length: %dsec.\n", minf.getTickLength(), minf.getResolution(), minf.getSecondLenght());
return 0;
}
示例9: DefaultOnClick
static int DefaultOnClick(WPARAM hContact, LPARAM lParam, LPARAM param)
{
Info *p = (Info*)param;
if (p == NULL)
return 0;
if (hContact == NULL)
return 0;
char *proto = GetContactProto(hContact);
if (IsEmpty(proto))
return 0;
bool found = false;
for (int j = 0; !found && j < SIZEOF(p->db); j += 2) {
if (p->db[j + 1] == NULL)
break;
ptrA szValue(db_get_sa(hContact, p->db[j] == NULL ? proto : p->db[j], p->db[j + 1]));
if (!IsEmpty(szValue)) {
p->OnClick(p, szValue);
found = true;
}
}
return 0;
}
示例10: DefaultOnClick
static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param)
{
Info *info = (Info *) param;
if (info == NULL)
return 0;
HANDLE hContact = (HANDLE) wParam;
if (hContact == NULL)
return 0;
char *proto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (IsEmpty(proto))
return 0;
bool found = false;
for (unsigned int j = 0; !found && j < MAX_REGS(info->db); j += 2)
{
if (info->db[j + 1] == NULL)
break;
DBVARIANT dbv = { 0 };
if (!DBGetContactSettingString(hContact, info->db[j] == NULL ? proto : info->db[j], info->db[j+1], &dbv))
{
if (!IsEmpty(dbv.ptszVal))
{
info->OnClick(info, dbv.ptszVal);
found = true;
}
DBFreeVariant(&dbv);
}
}
return 0;
}
示例11:
Info operator + (const Info &L,const Info &R){
Info ret;
ret.init(L.siz + R.siz);
for(int i=0;i<3;i++){
ret.s[i] = (L.s[i] + R.s[i]) % mod;
}
return ret;
}
示例12:
const RadialGroup::Info RadialGroup::getDefaultRadial () const
{
Info rfgi;
rfgi.setFamilyId(0);
rfgi.setChildChoice(0.f);
return rfgi;
}
示例13: ValidArgs
static bool ValidArgs(const Info& info, size_t rowBytes, size_t* minSize) {
const int maxDimension = SK_MaxS32 >> 2;
if (info.width() <= 0 || info.height() <= 0) {
return false;
}
if (info.width() > maxDimension || info.height() > maxDimension) {
return false;
}
if ((unsigned)info.colorType() > (unsigned)kLastEnum_SkColorType) {
return false;
}
if ((unsigned)info.alphaType() > (unsigned)kLastEnum_SkAlphaType) {
return false;
}
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
if (!info.validRowBytes(rowBytes)) {
return false;
}
size_t size = info.computeByteSize(rowBytes);
if (SkImageInfo::ByteSizeOverflowed(size)) {
return false;
}
if (minSize) {
*minSize = size;
}
return true;
}
示例14: ValidArgs
static bool ValidArgs(const Info& info, size_t rowBytes, size_t* minSize) {
const int maxDimension = SK_MaxS32 >> 2;
if (info.width() <= 0 || info.height() <= 0) {
return false;
}
if (info.width() > maxDimension || info.height() > maxDimension) {
return false;
}
if ((unsigned)info.colorType() > (unsigned)kLastEnum_SkColorType) {
return false;
}
if ((unsigned)info.alphaType() > (unsigned)kLastEnum_SkAlphaType) {
return false;
}
if (kUnknown_SkColorType == info.colorType()) {
return false;
}
if (rowBytes < info.minRowBytes()) {
return false;
}
size_t size = info.getSafeSize(rowBytes);
if (0 == size) {
return false;
}
if (minSize) {
*minSize = size;
}
return true;
}
示例15: error
void Admin::SetOperation(const Operation & op, OpVector & res)
{
const std::vector<Root> & args = op->getArgs();
if (args.empty()) {
error(op, "Set has no args.", res, getId());
return;
}
const Root & arg = args.front();
if (!arg->hasAttrFlag(Atlas::Objects::OBJTYPE_FLAG)) {
error(op, "Set arg has no objtype.", res, getId());
return;
}
const std::string & objtype = arg->getObjtype();
if (!arg->hasAttrFlag(Atlas::Objects::ID_FLAG)) {
error(op, "Set arg has no id.", res, getId());
return;
}
const std::string & id = arg->getId();
if (objtype == "object" || objtype == "obj") {
long intId = integerId(id);
if (intId == getIntId()) {
setAttribute(arg);
} else {
if (m_charactersDict.find(intId) != m_charactersDict.end()) {
Account::SetOperation(op, res);
return;
}
log(WARNING, "Unable to set attributes of non-character yet");
}
// Manipulate attributes of existing objects.
} else if (objtype == "class" || objtype == "op_definition") {
if (Inheritance::instance().hasClass(id)) {
if (Ruleset::instance()->modifyRule(id, arg) == 0) {
Info info;
info->setTo(getId());
info->setArgs1(arg);
res.push_back(info);
} else {
error(op, "Updating type failed", res, getId());
}
return;
}
error(op, "Client attempting to use obsolete Set to install new type",
res, getId());
return;
} else {
error(op, "Unknow object type set", res, getId());
return;
}
}