• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getFilenameExtension

XString getFilenameExtension(XString s)
{       
  int i = s.findRev('.');

  s = s.mid(i + 1);
  return s; 
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:7,代码来源:main.cpp


示例2: InitCommonControls

int GameLoop::InitInstance()
{
    int code = App::InitInstance();

    InitCommonControls();

    //img_pacman = ImageList_LoadBitmap(App::GetInstance(), MAKEINTRESOURCE(IDB_BITMAP1),32, 0, RGB(255, 0, 255));
    XString title;
    title.LoadFromResource(IDS_APP_TITLE);

    XString wclass;
    wclass.LoadFromResource(IDC_OOPACMAN);

    RECT rect = game->get_map()->get_rect();

    DWORD style = WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME;

    AdjustWindowRect(&rect, style, FALSE);

    if (!window.CreateWnd(title,
        style,
        CW_USEDEFAULT, 0,
        rect.right-rect.left, rect.bottom-rect.top,
        NULL, LPCTSTR(NULL))
       )
        return 1;

    SetMainWindow(&window);

    window.ShowWindow(_cmdShow);
    window.UpdateWindow();
    return code;
}
开发者ID:be9,项目名称:oop_course_tasks,代码行数:33,代码来源:gameloop.cpp


示例3: error

/*
 *******************************************************************
 * Function: IGBLSMConfigurationAccess::RemoveCIS
 *
 * Description: Removes a CIS and all associated CIs from persistent storage.
 *
 *
 * Parameters: 
 *    CGBLCISID cisid
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMConfigurationAccess::RemoveCIS( CGBLCISID cisid )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString     query;
        XString     dbName;

        storageManager->GetDbName( dbName );

        query << "DELETE FROM " << dbName << ".ciss WHERE ID=" << (int)cisid;

        // Now execute it and check the response...
        int queryResult = storageManager->ExecuteBlockingSQL( query.Str() );

        if( queryResult != CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }
    }

    return error;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:44,代码来源:GBLSMConfigurationAccess.cpp


示例4: fname

//************************************
// Method:    GetDocument
// FullName:  vtPhysics::pFactory::GetDocument
// Access:    public 
// Returns:   TiXmlDocument*
// Qualifier:
// Parameter: XString filename
//************************************
TiXmlDocument* pFactory::getDocument(XString filename)
{
	

	XString fname(filename.Str());
	if ( fname.Length() )
	{
		XString fnameTest = ResolveFileName(fname.CStr());
		if ( fnameTest.Length())
		{
			TiXmlDocument* result  = new TiXmlDocument(fnameTest.Str());
			result->LoadFile(fnameTest.Str());
			result->Parse(fnameTest.Str());

			TiXmlNode* node = result->FirstChild( "vtPhysics" );
			if (!node)
			{
				GetPMan()->m_Context->OutputToConsoleEx("PFactory : Couldn't load Document : %s",filename.Str());
				return NULL;
			}else
			{
				return result;
			}
		}
	}
	return NULL;
}
开发者ID:gbaumgart,项目名称:vt,代码行数:35,代码来源:pFactoryXML.cpp


示例5: error

/*
 *******************************************************************
 * Function: IGBLSMLAEAccess::RemoveUser
 *
 * Description: Removes the association between a user and an LAE.
 *
 *
 * Parameters: 
 *     CGBLLAEID laeid
 *    CGBLUserID user
 *
 * Returns: 
 *    CGBLCOError 
 *
 *******************************************************************
 */
CGBLCOError IGBLSMLAEAccess::RemoveUser( CGBLLAEID laeid, CGBLUserID user )
{
    CGBLCOError   error(CGBLCOError::EGBLCOErrorType::GBLCO_OK);

    // Check we're actually connected to the server first...
	if ( !(storageManager->IsConnected()) )
	{
		error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION_DESC, GBLSM_ERROR_PROFILEACCESS_NO_CONNECTION );
	}
    else
    {
        XString     query;
        XString     dbName;

        // Get the name of the DB we're using
        storageManager->GetDbName(dbName);

        // Now build the query
        query = "";
        query << "DELETE FROM " << dbName << ".EventUsers WHERE LAEID=" << (int)laeid << " AND UserID=" << (int)user;

        // Execute the query
        int     deleteResult = storageManager->ExecuteBlockingSQL( query.Str() );

        if( deleteResult != CGBLSMStorageManager::EGBLStorageManagerExecutionStatus::NoResult )
        {
            error = CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL, GBLSM_ERROR_GENERAL_SQL_ERROR_DESC, GBLSM_ERROR_GENERAL_SQL_ERROR);
        }
    }

	return error;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:48,代码来源:GBLSMLAEAccess.cpp


示例6: Add2

void Add2()
{
	XString str = L"Hello";
	str += L" ";
	str += L"World";
	wprintf(L"%s\n", str.GetString());
}
开发者ID:kippler,项目名称:Samples,代码行数:7,代码来源:main.cpp


示例7: CGBLCOError

CGBLCOError 
GBLCommon::ResourceTools::SaveObject(
	CKBeObject*beo,
	XString filename)
{
	if (!beo)
	{
		return CGBLCOError(CGBLCOError::GBLCO_LOCAL,"Invalid Object",GBL_ERROR_ID_GBL_COMMON);
	}

	//todo : adding checks for saving ability 
	if(!filename.Length())
	{
		return CGBLCOError(CGBLCOError::GBLCO_LOCAL,"No path specified",GBL_ERROR_ID_GBL_COMMON);
	}
	
	CKERROR res = CK_OK;
    
	CKObjectArray* oa = CreateCKObjectArray();
	oa->InsertAt(beo->GetID());
	res = beo->GetCKContext()->Save(filename.Str(),oa,0xFFFFFFFF,NULL);
	DeleteCKObjectArray(oa);
	
	return CGBLCOError(CGBLCOError::EGBLCOErrorType::GBLCO_LOCAL,CKErrorToString(res),GBL_ERROR_ID_GBL_COMMON);
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:25,代码来源:GBLResourceTools.cpp


示例8: pWheelContactModify

void pWheel2::setWheelContactScript(int val)
{

	CKBehavior * beh  = (CKBehavior*)GetPMan()->GetContext()->GetObject(val);
	if (!beh)
		return;

	XString errMessage;
	if (!GetPMan()->checkCallbackSignature(beh,CB_OnWheelContactModify,errMessage))
	{
		xError(errMessage.Str());
		return;
	}
	
	pCallbackObject::setWheelContactScript(val);

	wheelContactModifyCallback  = new pWheelContactModify();
	wheelContactModifyCallback->setWheel(this);

	getWheelShape()->setUserWheelContactModify((NxUserWheelContactModify*)wheelContactModifyCallback);


	//----------------------------------------------------------------
	//track information about callback	
	getBody()->getCallMask().set(CB_OnWheelContactModify,true);


}
开发者ID:gbaumgart,项目名称:vt,代码行数:28,代码来源:pWheel2Run.cpp


示例9: SaveFile

BOOL MyAppWindow :: SaveFile( void )
{
   XFile savefile;
   XString s;

   mle->GetText( &s );

   /* now open the file, create a new one if the given filename is not existing, otherwise overwrite */
   /* it. open the file for write-access, dont allow any other programm to use the file while it is open*/
   if( savefile.Open( path, XFILE_CREATE_IF_NEW | XFILE_REPLACE_EXISTING, XFILE_SHARE_DENYNONE | XFILE_WRITEONLY, s.GetLength()) == 0)
      {
         /* set the file-cursor to the beginning of the file */
         savefile.Seek( 0, FILE_BEGIN);

         /*save the string */
         savefile.Write ( (char*) s, s.GetLength());

         /* close the file */
         savefile.Close();
         saved = TRUE;
         return TRUE;
      }
   else
      {
         XMessageBox( "could not open file", "error", MB_OK| MB_ERROR);
         return FALSE;
      }
}
开发者ID:OS2World,项目名称:LIB-Open_Object_Library,代码行数:28,代码来源:sample1.cpp


示例10: TimeDiff

void CGBLStorageManagerTestBBBase::StopAndShowTimeMeasure(ofstream &_trace, float &totalTime)
{
    float executionTime = TimeDiff();
	totalTime += executionTime;
	XString disp = "";
	disp << executionTime;
	_trace << "Execution time: " << disp.Str() << " seconds" <<endl;
}
开发者ID:gbaumgart,项目名称:GBL_Backup,代码行数:8,代码来源:GBLStorageManagerTestBBBase.cpp


示例11: WBUF_STRING

inline
void WBUF_STRING(uint8_t *p, size_t pos, XString s, size_t len)
{
    char *const begin = static_cast<char *>(WBUFP(p, pos));
    char *const end = begin + len;
    char *const mid = std::copy(s.begin(), s.end(), begin);
    std::fill(mid, end, '\0');
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:8,代码来源:socket.hpp


示例12: WFIFO_STRING

inline
void WFIFO_STRING(int fd, size_t pos, XString s, size_t len)
{
    char *const begin = static_cast<char *>(WFIFOP(fd, pos));
    char *const end = begin + len;
    char *const mid = std::copy(s.begin(), s.end(), begin);
    std::fill(mid, end, '\0');
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:8,代码来源:socket.hpp


示例13: read_constdb

bool read_constdb(ZString filename)
{
    io::ReadFile in(filename);
    if (!in.is_open())
    {
        PRINTF("can't read %s\n"_fmt, filename);
        return false;
    }

    bool rv = true;
    AString line_;
    while (in.getline(line_))
    {
        // is_comment only works for whole-line comments
        // that could change once the Z dependency is dropped ...
        LString comment = "//"_s;
        XString line = line_.xislice_h(std::search(line_.begin(), line_.end(), comment.begin(), comment.end())).rstrip();
        if (!line)
            continue;
        // "%m[A-Za-z0-9_] %i %i"

        // TODO promote either qsplit() or asplit()
        auto _it = std::find(line.begin(), line.end(), ' ');
        auto name = line.xislice_h(_it);
        auto _rest = line.xislice_t(_it);
        while (_rest.startswith(' '))
            _rest = _rest.xslice_t(1);
        auto _it2 = std::find(_rest.begin(), _rest.end(), ' ');
        auto val_ = _rest.xislice_h(_it2);
        auto type_ = _rest.xislice_t(_it2);
        while (type_.startswith(' '))
            type_ = type_.xslice_t(1);
        // yes, the above actually DTRT even for underlength input

        int val;
        int type = 0;
        // Note for future archeaologists: this code is indented correctly
        if (std::find_if_not(name.begin(), name.end(),
                    [](char c)
                    {
                        return ('0' <= c && c <= '9')
                            || ('A' <= c && c <= 'Z')
                            || ('a' <= c && c <= 'z')
                            || (c == '_');
                    }) != name.end()
                || !extract(val_, &val)
                || (!extract(type_, &type) && type_))
        {
            PRINTF("Bad const line: %s\n"_fmt, line_);
            rv = false;
            continue;
        }
        P<str_data_t> n = add_strp(name);
        n->type = type ? StringCode::PARAM : StringCode::INT;
        n->val = val;
    }
    return rv;
}
开发者ID:GermanTMW2015,项目名称:tmwa,代码行数:58,代码来源:script-startup.cpp


示例14: LoadFile

/* load a file */
BOOL MyAppWindow :: LoadFile ( char * p)
{
   // is there already a file loaded or has the user entered some text?
   if(loaded == FALSE && saved == TRUE)
      {
         //no, we load the file in the window of the current thread
         XFile loadfile;

         /* now open the file, fail if given filename is not existing */
         /* open the file for read-access, dont allow any other programm to use the file while it is open*/
         if( loadfile.Open( p, XFILE_FAIL_IF_NEW | XFILE_OPEN_EXISTING, XFILE_SHARE_DENYWRITE | XFILE_READONLY ) == 0)
           {
              XString s;

              loading = TRUE;

              //how large is the file?
              XFileInfo info;
              loadfile.GetFileInfo( &info );
              LONG size = info.GetFileSize();

              //read the complete file
              loadfile.Read ( (PVOID) s.GetBuffer(info.GetFileSize() + 1), size);
              s.ReleaseBuffer( info.GetFileSize() );

              //set the XString content to the mle
              mle->SetText( s );
              //dontïforget to close the file
              loadfile.Close();
              loaded = TRUE;
              path = p;
              mle->SetFocus();
              GetText( &s );
              s+= " - ";
              s+= p;
              SetText( s );

              loading = FALSE;

              return TRUE;
            }
         else
            {
               XMessageBox( p, "couldnït open File!", MB_OK|MB_ERROR);
               return FALSE;
            }
      }
   else
     {
         //there is a file loaded, or the user has entered some text, so
         // we create a new window and load the file
//         XResource res( IDM_MAIN, ((MyApp*) GetProcess())->GetResourceLibrary());
         MyAppWindow * win = new MyAppWindow( IDM_MAIN );
         win->LoadFile(p);
         return TRUE;
     }
}
开发者ID:OS2World,项目名称:LIB-Open_Object_Library,代码行数:58,代码来源:sample1.cpp


示例15: getFilenameWithoutPathAndExtension

XString getFilenameWithoutPathAndExtension(XString s)
{       
  XString k = getFilenameWithoutPath(s);

  int i = k.findRev('.');

  k = k.left(i);
  return k; 
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:9,代码来源:main.cpp


示例16: getFilenameWithoutPath

XString getFilenameWithoutPath(XString s)
{       
  int i = s.findRev('\\');
  if (i == -1){
    i = s.findRev('/');
  }
  s = s.right(s.length() - i - 1);
  return s; 
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:9,代码来源:main.cpp


示例17: IsEqual

	bool IsEqual(const XString& str1,const XString& str2)
	{
		if(str1.length() != str2.length()) return false;
		XString v1(str1);
		XString v2(str2);
		ToLower(v1);
		ToLower(v2);
		return v1 == v2;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp


示例18: EndsWith

	bool EndsWith(const XString& str,const XString& substr)
	{
		if(substr.length() > str.length()) return false;
		for (XString::size_type i=str.length()-1,j=substr.length()-1;j>0;--i,--j)
		{
			if(substr[j] != str[i]) return false;
		}
		return true;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp


示例19: StartsWith

	bool StartsWith(const XString& str,const XString& substr)
	{
		if(substr.length() > str.length()) return false;
		for (XString::size_type i=0;i<substr.length();++i)
		{
			if(substr[i] != str[i]) return false;
		}
		return true;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp


示例20: sizeof

void PhysicManager::_checkObjectsByAttribute(CKScene *newScene)
{

	CKAttributeManager* attman = m_Context->GetAttributeManager();
	int sizeJFuncMap = ATT_FUNC_TABLE_SIZE;//(sizeof(*getRegistrationTable()) / sizeof((getRegistrationTable())[0]));
	for (int fIndex = 0  ; fIndex  < sizeJFuncMap ; fIndex ++)
	{

		std::vector<int>attributeIdList;
		pFactory::Instance()->findAttributeIdentifiersByGuid(getRegistrationTable()[fIndex].guid,attributeIdList);
		int attCount = attributeIdList.size();

		for (int i = 0 ; i < attCount ; i++ )
		{
			int currentAttType = attributeIdList.at(i);
			const XObjectPointerArray& Array = attman->GetAttributeListPtr( attributeIdList.at(i) );
			for (CKObject** it = Array.Begin(); it != Array.End(); ++it)
			{	
				CK3dEntity *target = static_cast<CK3dEntity*>(*it);
				if (target)
				{
					XString error;
					error.Format("Registering :%s with %s",target->GetName(),attman->GetAttributeNameByType(currentAttType));
					//if(!strcmp( target->GetName(),"smutan3-3" ) )					{					//		xLogger::xLog(XL_START,ELOGTRACE,E_LI_MANAGER,"problem case" );					}

//					CKScene *levelScene = GetContext()->GetCurrentLevel()->GetCurrentScene();
					// we check as no scene is current in use 
					if (		(	
								GetContext()->GetCurrentLevel()->GetLevelScene() == newScene &&
								!isSceneObject2(target) 
							)
							||
							(	newScene && newScene->IsObjectHere(target) && newScene !=GetContext()->GetCurrentLevel()->GetLevelScene() )
							||
							(	
								newScene &&
								GetContext()->GetCurrentLevel()->GetCurrentScene() && 
								GetContext()->GetCurrentLevel()->GetCurrentScene() == newScene &&
								newScene !=GetContext()->GetCurrentLevel()->GetLevelScene() &&
								newScene->IsObjectHere(target)
							)
							||
							(
								(physicFlags & PMF_DONT_DELETE_SCENES) 
							)
						)
					{
							xLogger::xLog(XL_START,ELOGTRACE,E_LI_MANAGER,error.CStr() );
							(*getRegistrationTable()[fIndex].rFunc)(target,currentAttType,true,false);
							GetPMan()->getCheckList().PushBack(target->GetID());
					}
				}
			}
		}
	}
}
开发者ID:gbaumgart,项目名称:vt,代码行数:56,代码来源:PhysicManagerAttributeRegistry.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XTreeWidgetItem::addChild方法代码示例发布时间:2022-05-31
下一篇:
C++ XSqlQuery类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap