当前位置: 首页>>代码示例>>C++>>正文


C++ Struct类代码示例

本文整理汇总了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));
}
开发者ID:MrMC,项目名称:ulxmlrpcpp,代码行数:7,代码来源:ulxr_dispatcher.cpp

示例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);
}
开发者ID:jfenton,项目名称:pixelboost,代码行数:26,代码来源:manager.cpp

示例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;
}
开发者ID:zhangjitao,项目名称:DDLParser,代码行数:26,代码来源:StructIf.cpp

示例4: Check

int DDLT::Struct::l__gc( lua_State* L )
{
    Struct* self = Check( L, 1 );

    self->Destroy();
    return 0;
}
开发者ID:zhangjitao,项目名称:DDLParser,代码行数:7,代码来源:StructIf.cpp

示例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;
}
开发者ID:5432935,项目名称:crossbridge,代码行数:8,代码来源:enum4.C

示例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;
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:8,代码来源:enum4.C

示例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();
}
开发者ID:normalJaylan,项目名称:CPP-Programs,代码行数:58,代码来源:start.cpp

示例8: mxGetNumberOfFields

int mxGetNumberOfFields(const mxArray *ptr)
{
    if (!mxIsStruct(ptr))
    {
        return 0;
    }
    Struct * pa = (Struct *)ptr;
    return pa->getFieldNames()->getSize();
}
开发者ID:scitao,项目名称:scilab,代码行数:9,代码来源:mexlib.cpp

示例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;
}
开发者ID:scitao,项目名称:scilab,代码行数:11,代码来源:mexlib.cpp

示例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);
}
开发者ID:scitao,项目名称:scilab,代码行数:11,代码来源:mexlib.cpp

示例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();
		}
	}
}
开发者ID:RobertoMalatesta,项目名称:of-1,代码行数:11,代码来源:Utility.cpp

示例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;
    
}
开发者ID:CCJY,项目名称:coliru,代码行数:12,代码来源:main.cpp

示例13: GetParent

  bool
  Struct::IsInherited ( StructField* field )
  {
    Struct* parent = GetParent();

    if ( parent != 0 && parent->FindField ( field->GetValueInfo()->GetNameHash() ) != 0 )
    {
      return true;
    }

    return false;
  }
开发者ID:macton,项目名称:DDLParser,代码行数:12,代码来源:DDLParser.cpp

示例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;
}
开发者ID:MattPD,项目名称:poco,代码行数:14,代码来源:Function.cpp

示例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();
}
开发者ID:facebook,项目名称:fbthrift,代码行数:15,代码来源:ThriftVsProtoBufBench.cpp


注:本文中的Struct类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。