本文整理汇总了C++中Struct类的典型用法代码示例。如果您正苦于以下问题:C++ Struct类的具体用法?C++ Struct怎么用?C++ Struct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Struct类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCapabilities
void Dispatcher::getCapabilities (Struct &str) const
{
// parent::getCapabilities (str); just in case..
str.addMember("specUrl",
RpcString("http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php"));
str.addMember("specVersion", Integer(20010516));
}
示例2: OpenRecord
void DatabaseManager::OpenRecord(const std::string& filename)
{
std::string recordData = libpixel::FileHelpers::FileToString(filename);
json::Object record;
json::Reader::Read(record, recordData);
json::String& type = record["Type"];
Struct* s = DatabaseManager::Instance()->Create(type.Value());
if (!s)
return;
if (s->GetType() != 2) // kDbRecord
{
delete s;
return;
}
s->Deserialise(record, 0);
_Records.push_back(static_cast<Record*>(s));
_UidMap[s->_Uid] = static_cast<Record*>(s);
}
示例3: new
int DDLT::Struct::PushNew( lua_State* L, DDLParser::Definition* definition, DDLParser::Struct* structure )
{
Struct* self = new ( lua_newuserdata( L, sizeof( Struct ) ) ) Struct;
if ( !self->Init( definition, structure ) )
{
return luaL_error( L, "Error creating DDLT::Struct" );
}
if ( luaL_newmetatable( L, "DDLT::Struct" ) )
{
lua_pushcfunction( L, getName );
lua_setfield( L, -2, "__tostring" );
lua_pushcfunction( L, getNumFields );
lua_setfield( L, -2, "__len" );
lua_pushcfunction( L, l__index );
lua_setfield( L, -2, "__index" );
lua_pushcfunction( L, l__gc );
lua_setfield( L, -2, "__gc" );
lua_pushcfunction( L, l__eq );
lua_setfield( L, -2, "__eq" );
}
lua_setmetatable( L, -2 );
return 1;
}
示例4: Check
int DDLT::Struct::l__gc( lua_State* L )
{
Struct* self = Check( L, 1 );
self->Destroy();
return 0;
}
示例5: main
int main()
{
Enum e = enumerator1;
Struct s;
int x = funct(e+1);// { dg-error "" } .*
int y = s.getI(e+1);// { dg-error "" } .*
return x+y;
}
示例6: main
int main()
{
Enum e = enumerator1;
Struct s;
int x = funct(e+1);// { dg-error "invalid" }
int y = s.getI(e+1);// { dg-error "match" }
return x+y;
}
示例7: start
void start() {
int number(1);
Struct *head = new Struct();
Struct *temp;
cout << "Start X : ";
cin >> head->x;
cout << "Start Y : ";
cin >> head->y;
head->next = NULL;
horse->path[head->x][head->y] = number++;
horse->mark[head->x][head->y] = 0;
while (number <= (SIZE * SIZE)) {
if (number == (SIZE * SIZE)) { //最后一步单独处理
for (int i(0);i < SIZE;i++) {
for (int j(0);j < SIZE;j++) {
if (horse->mark[i][j] == 1) {
head = head->add(i, j, head, 0);
horse->path[i][j] = number++;
horse->mark[i][j] = 0;
break;
}
}
}
continue;
}
horse->init(); //初始化权值表
horse->updateWeight(head->x, head->y); //更新这一点的权值表
if (flag) {
horse->weight[temp->key] == SIZE + 1;
}
int key = horse->findSmall(); //找到权值最小的点
if (key == -1 && number != (SIZE * SIZE + 1)) {
horse->mark[head->x][head->y] == 1;
horse->path[head->x][head->y] == 0;
number--;
temp = head;
head = head->remove(head);
flag = true;
continue;
}
x = head->x;
y = head->y;
getXY(key); //得到该点对应的坐标
head = head->add(x, y, head, key); //将新走的位置坐标插入链表
// cout << head->x << " , " << head->y << " " << number << endl;
horse->path[head->x][head->y] = number++;
horse->mark[head->x][head->y] = 0; //标记为已走过
}
print();
}
示例8: mxGetNumberOfFields
int mxGetNumberOfFields(const mxArray *ptr)
{
if (!mxIsStruct(ptr))
{
return 0;
}
Struct * pa = (Struct *)ptr;
return pa->getFieldNames()->getSize();
}
示例9: Struct
mxArray *mxCreateStructArray(int ndim, const int *dims, int nfields, const char **field_names)
{
Struct *ptr = new Struct(ndim, (int *)dims);
for (int i = 0; i < nfields; i++)
{
wchar_t *name = to_wide_string(field_names[i]);
ptr->addField(name);
FREE(name);
}
return (mxArray *)ptr;
}
示例10: mxAddField
int mxAddField(mxArray *ptr, const char *fieldname)
{
if (!mxIsStruct(ptr))
{
return -1;
}
Struct *pa = (Struct *)ptr;
wchar_t *wfieldname = to_wide_string(fieldname);
pa->addField(wfieldname);
return mxGetFieldNumber(ptr, fieldname);
}
示例11: fixup
void Utility::fixup(NameSpace::SymbolTable& st)
{
for (NameSpace::SymbolTable::iterator it = st.begin(); it != st.end(); ++it)
{
Struct* pStruct = dynamic_cast<Struct*>(it->second);
if (pStruct)
{
pStruct->fixupBases();
}
}
}
示例12: main
int main ()
{
Struct a;
a.f.data = "Hello";
a.g.data = "World";
Struct::fields_t obj = a.get_fields();
cout << obj["f"]->get_data() << endl;
cout << obj["g"]->get_data() << endl;
}
示例13: GetParent
bool
Struct::IsInherited ( StructField* field )
{
Struct* parent = GetParent();
if ( parent != 0 && parent->FindField ( field->GetValueInfo()->GetNameHash() ) != 0 )
{
return true;
}
return false;
}
示例14: if
bool Function::isVirtual() const
{
if (_flags & FN_VIRTUAL)
{
return true;
}
else if (isDestructor())
{
Struct* pClass = dynamic_cast<Struct*>(nameSpace());
return pClass && pClass->hasVirtualDestructor();
}
else return getOverridden() != 0;
return false;
}
示例15: readBench
void readBench(size_t iter) {
BenchmarkSuspender susp;
auto strct = create<Struct>();
string s;
strct.SerializeToString(&s);
susp.dismiss();
while (iter--) {
Struct data;
data.ParseFromString(s);
folly::doNotOptimizeAway(data);
}
susp.rehire();
}