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


C++ ListPtr类代码示例

本文整理汇总了C++中ListPtr的典型用法代码示例。如果您正苦于以下问题:C++ ListPtr类的具体用法?C++ ListPtr怎么用?C++ ListPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ListPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AppendListWithoutCopy

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~FUNCTION~~~~~~
 NOTES: Similar as the above, but it adds every element in the given list,
 		rather than the list itself.
*/
void List::AppendListWithoutCopy( ListPtr X )
{
	unsigned int i;
	for( i = 0; i< X->GetInternalList().size(); i++ )
	{
		PushWithoutCopy( X->GetInternalList()[i] );
	}
}
开发者ID:BackupTheBerlios,项目名称:storyscript-svn,代码行数:12,代码来源:List.cpp

示例2: typeToString

void Slice::ChecksumVisitor::visitList(const ListPtr& p)
{
  if (p->isLocal()) {
    return;
  }

  ostringstream ostr;
  ostr << "list<" << typeToString(p->type()) << "> " << p->name() << endl;
  updateMap(p->scoped(), ostr.str());
}
开发者ID:wuhua988,项目名称:icm,代码行数:10,代码来源:Checksum.cpp

示例3: parseFontSpec

List<Font::CHAR_INFO> parseFontSpec(const String& filename) {
	#ifdef _DEBUG
	printf("\t parsing fontSpec\n");
	#endif
	String s;
	
	if (!load_text_file(filename, &s)) {
		//TODO: error
	}

	ListPtr<String*> strings;
	s.split(strings, " \n");
	uint_d size = strings.getSize();

	if (*strings[0] != "#spec" && *strings[size-1] != "#end") {
		//TODO: log error
	}

	List<Font::CHAR_INFO> charSpec;

	for (uint_d i = 1; i < size; i+=5) {
		String& character = *strings[i];
		if (character == "#end") {
			break;
		} else if (character == "" || character == "\n" || character == " ") {
			continue;
		} else {
			Font::CHAR_INFO cInfo;
			cInfo.c = character[0];
			const char c = (*strings[i + 1])[0];
			if (c == '#') {
				Font::CHAR_INFO exist = getCharInfoFromSpec(charSpec, (*strings[i + 1])[1]);
				exist.c = cInfo.c;
				charSpec << exist;
			}else {

				cInfo.xOffset = (float)atof(**strings[i + 1]);
				cInfo.yOffset = (float)atof(**strings[i + 2]);
				cInfo.cWidth = (float)atof(**strings[i + 3]);
				cInfo.cHeight = (float)atof(**strings[i + 4]);
				charSpec << cInfo;
				#ifdef _DEBUG
				printf("\t\t Retriving %c\n", cInfo.c);
				#endif
			}
		}
	}

	#ifdef _DEBUG
	printf("\t Done!\n");
	#endif
	return charSpec;
}
开发者ID:JeppeSRC,项目名称:TheThing,代码行数:53,代码来源:font.cpp

示例4:

VariableBasePtr List::PushOp::Operate( VariableBasePtr pX )
{
	ListPtr pXList = pX->CastToList();
	
	const ListType& XList = pXList->GetInternalList();
	size_t i;
	for( i = 0; i < XList.size(); i++ )
	{
		mParentList.Push( XList[i] );
	}
	
	return mParentList.CastToVariableBase();	
}
开发者ID:BackupTheBerlios,项目名称:storyscript-svn,代码行数:13,代码来源:List.cpp

示例5: addMiddleList

int addMiddleList(ListPtr listp,NodePtr position,void* data){ /* Add new Node in the middle of the Queue */

	int i=0;

	//there is always a previous and a next Node
	if(listp->items > 0){
		if(position == NULL) {
			printf("Position not valid...\n");
			return -1;
		}
		else {
			listp->Current = position->previous; //Current is the previous Node 
		}

		listp->Current->next = malloc(sizeof(Node));
		listp->Current->next->previous = listp->Current;
		listp->Current->next->next = position;
		position->previous = listp->Current->next;
		
		listp->allocateNode(&(listp->Current->next->data),data);

		listp->Current = listp->Head;

		(listp->items)++;

	}
	else{
		printf("List is not properly initialised...\n");
		return -1;
	}
}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:31,代码来源:uberlist.c

示例6: removeLastList

void removeLastList(ListPtr listp){ /* Removes 1 Node from the Start of the List */

	if(listp->items > 0){

		if(listp->items == 1){ 
			popList(listp);
		}
		else{

			listp->Current = listp->Last->previous;

			if(listp->Last != NULL){

				listp->destroyNode(&(listp->Last->data));

				free(listp->Last);

				(listp->items)--;
			}

			listp->Last = listp->Current;

			listp->Last->next = (Node*) NULL;

		}

	}

}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:29,代码来源:uberlist.c

示例7: AppendList

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~FUNCTION~~~~~~
 List::AppendList
 NOTES: Adds all the elements of one list onto another.
*/
void List::AppendList( const ListPtr OtherList ){
	unsigned int i;
	const ListType& OtherVector = OtherList->GetInternalList();
	
	for( i = 0; i < OtherVector.size(); i++ ){
		mList.push_back( CreateVariable<Variable>( SS_BASE_ARGS_DEFAULTS, *(OtherVector[i]->CastToVariable()) ) );
	}
}
开发者ID:BackupTheBerlios,项目名称:storyscript-svn,代码行数:12,代码来源:List.cpp

示例8: addLastList

int addLastList(ListPtr listp,void* data){ /* Adds a Node to the end of the List */

	int i=0;

	if(listp->items == 0){ /* No items yet */

		listp->Head = malloc(sizeof(Node));
		listp->allocateNode(&(listp->Head->data),data);

		listp->Head->next = (Node*) NULL;
		listp->Head->previous = (Node*) NULL;

		listp->Current = listp->Head;
		listp->Last = listp->Head;

		(listp->items)++;

		return 0;
	}
	else if(listp->items > 0){

		listp->Last->next = malloc(sizeof(Node));

		listp->Last->next->previous = listp->Last;
		listp->Last = listp->Last->next;
		listp->Last->next = (Node*) NULL;
	
		listp->allocateNode(&(listp->Last->data),data);

		(listp->items)++;

		listp->Current = listp->Last;


		return 0;
	}
	else{
		printf("List is not properly initialised...\n");
		return -1;
	}

}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:42,代码来源:uberlist.c

示例9: switch

void Bencoder::parseNextType(const std::string& str, unsigned int& pos, ListPtr list)
{
    m_logger->log(logger::Logger::FINE, "Bencoder::parseNextType()");

    switch (str[pos])
    {
        case 'd':
            break;
        case 'l':
        {
            ListPtr l = parseList(str, pos);
            //m_lists.push_back( reinterpret_cast<AnyType>(l) );
            break;
        }
        case 'i':
        {
            list->push_back( parseInteger(str, pos) );
            break;
        }
        default:
            list->push_back( parseString(str, pos) );
            break;
    }
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例10: addFirstList

int addFirstList(ListPtr listp,void* data){ /* Add new Node as Head of the Queue */

	int i=0;

	if(listp->items == 0){
		listp->Head = malloc(sizeof(Node));
		listp->allocateNode(&(listp->Head->data),data);

		listp->Head->next = (Node*) NULL;
		listp->Head->previous = (Node*) NULL;
		listp->Current = listp->Head;
		listp->Last = listp->Head;

		(listp->items)++;
		return 0;
	}
	else if(listp->items > 0){

		listp->Head->previous = malloc(sizeof(Node));
		listp->Head->previous->next = listp->Head;
		listp->Head = listp->Head->previous;
		
		listp->allocateNode(&(listp->Head->data),data);

		listp->Head->previous = (Node*) NULL;

		listp->Current = listp->Head;

		(listp->items)++;

	}
	else{
		printf("List is not properly initialised...\n");
		return -1;
	}
}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:36,代码来源:uberlist.c

示例11: search

/**
 * this method searches the nodes in the list to find one with the same jobid as the passed in value
 */
NodePtr search(const ListPtr list, const void * searchFor)
{
	if (list == NULL )
		return NULL ;
	if (list->size < 0 || (list->head != NULL && list->head->data == NULL) || (list->tail != NULL && list->tail->data == NULL))
		return NULL;
	if (list ->size == 0 && list->head == NULL && list->tail ==NULL)
		return NULL;
	if (searchFor == NULL)
		return NULL;

	NodePtr temp = list->head;
	while (temp != NULL ) {
		if (list->compareTo(searchFor, temp->data))
			return temp;
		else
			temp = temp->next;
	}
	return NULL;
}
开发者ID:chilininsd,项目名称:operating_systems,代码行数:23,代码来源:List.c

示例12: popList

void popList(ListPtr listp){ /* Removes 1 Node from the End of the List */

	if(listp->items > 0){

		listp->Current = listp->Head;

		listp->Head = listp->Head->next; /* Make Head point to its next and make the previous of new Head be NULL */
		if(listp->Head != NULL)
			listp->Head->previous = (Node*) NULL;
		
		if(listp->Current != NULL){
			listp->destroyNode(&(listp->Current->data));
			free(listp->Current);
			(listp->items)--;
		}

		listp->Current = listp->Head;

	}

}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:21,代码来源:uberlist.c

示例13: search

NodePtr search(ListPtr list, const void * o) {
	NodePtr tempNode;
	if (list == NULL ) {
		return NULL ;
	}
	if (list->head == NULL ) {
		return NULL ;
	}
	tempNode = list->head;
	while (tempNode->next) {


		if (list->compareTo(( void *)o,( void *)tempNode->obj)==0) {
			return tempNode;

		}
		tempNode = tempNode->next;
	}

	return NULL ;
}
开发者ID:kgross99,项目名称:count,代码行数:21,代码来源:List.c

示例14: removeCurrentNode

void removeCurrentNode(ListPtr listp){ /* Removes the Node Current points to */

	Node* temp;

	if(listp->items > 0){

		if(listp->items == 1){ 
			popList(listp);
		}
		else{

			if(listp->Current == listp->Last){
				removeLastList(listp);
			}
			else{
				if(listp->Current != NULL){

					listp->destroyNode(&(listp->Current->data));

					temp = listp->Current->next;
					listp->Current->previous->next = listp->Current->next; /* Make the previous of the Current have as next the next of Current and vice versa */
					listp->Current->next->previous = listp->Current->previous;
			
					free(listp->Current);
				
					listp->Current = temp;
		
					(listp->items)--; //TODO: TEST AND FIX MIDDLE

				}
			}

		}

	}

}
开发者ID:PanagiotisPapageorgiou,项目名称:SoftDev2014-SocialNetworkDatabase,代码行数:37,代码来源:uberlist.c

示例15: TXT

///////////////////////////////////////////////////////////////////////////////
// Creates UI for the field variable specified.
// 
void ReflectStlSetInterpreter::InterpretField( const Reflect::Field* field, const std::vector<Reflect::Object*>& instances, Container* parent )
{
    if ( field->m_Flags & Reflect::FieldFlags::Hide )
    {
        return;
    }

    // create the container
    ContainerPtr container = CreateControl< Container >();
    parent->AddChild( container );

    tstring temp;
    field->GetProperty( TXT( "UIName" ), temp );
    if ( temp.empty() )
    {
        bool converted = Helium::ConvertString( field->m_Name, temp );
        HELIUM_ASSERT( converted );
    }

    container->a_Name.Set( temp );

    // create the data objects
    std::vector< Reflect::Object* >::const_iterator itr = instances.begin();
    std::vector< Reflect::Object* >::const_iterator end = instances.end();
    for ( ; itr != end; ++itr )
    {
        Reflect::DataPtr ser = Reflect::AssertCast< Reflect::Data >( Reflect::Registry::GetInstance()->CreateInstance( field->m_DataClass ) );
        uintptr_t fieldAddress = ( uintptr_t )( *itr ) + field->m_Offset;
        ser->ConnectData( ( void* )fieldAddress );
        m_Datas.push_back( ser );
    }

    // create the list
    ListPtr list = CreateControl< List >();
    list->a_HelpText.Set( field->GetProperty( TXT( "HelpText" ) ) );
    container->AddChild( list );

    // bind the ui to the serialiers
    list->Bind( new MultiStringFormatter< Reflect::Data >( (std::vector<Reflect::Data*>&)m_Datas ) );

    // create the buttons if we are not read only
    if ( !( field->m_Flags & Reflect::FieldFlags::ReadOnly ) )
    {
        ContainerPtr buttonContainer = CreateControl< Container >();
        container->AddChild( buttonContainer );

        ButtonPtr buttonAdd = CreateControl< Button >();
        buttonContainer->AddChild( buttonAdd );
        buttonAdd->a_Label.Set( TXT( "Add" ) );
        buttonAdd->a_HelpText.Set( TXT( "Add an item to the list." ) );
        buttonAdd->ButtonClickedEvent().Add( ButtonClickedSignature::Delegate ( this, &ReflectStlSetInterpreter::OnAdd ) );
        buttonAdd->SetClientData( new ClientData( list ) );

        ButtonPtr buttonRemove = CreateControl< Button >();
        buttonContainer->AddChild( buttonRemove );
        buttonRemove->a_Label.Set( TXT( "Remove" ) );
        buttonRemove->a_HelpText.Set( TXT( "Remove the selected item(s) from the list." ) );
        buttonRemove->ButtonClickedEvent().Add( ButtonClickedSignature::Delegate ( this, &ReflectStlSetInterpreter::OnRemove ) );
        buttonRemove->SetClientData( new ClientData( list ) );
    }

    // for now let's just disable this container if there is more than one item selected. I'm not sure if it will behave properly in this case.
    if ( instances.size() > 1 )
    {
        container->a_IsEnabled.Set( false );
    }
}
开发者ID:foolhuang,项目名称:Helium,代码行数:70,代码来源:ReflectStlSetInterpreter.cpp


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