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


C++ VString函数代码示例

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


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

示例1: REQUIRED

      /// <summary>Populates the library from the string library</summary>
      /// <param name="data">Feedback data</param>
      /// <returns>Number of objects found</returns>
      /// <exception cref="Logic::ArgumentNullException">Worker data is null</exception>
      /// <exception cref="Logic::InvalidOperationException">String library is empty</exception>
      UINT  ScriptObjectLibrary::Enumerate(WorkerData* data)
      {
         REQUIRED(data);

         // Ensure string library exists
         if (StringLib.Files.empty())
            throw InvalidOperationException(HERE, L"String library has not been enumerated");

         // Feedback
         data->SendFeedback(Cons::Heading, ProgressType::Operation, 1, L"Generating script objects from language files");

         // Populate
         Clear();
         Populate(data);

         // DEBUG:
         Console << "Discovered " << (int)Objects.size() << " script objects..." << ENDL;
         
         // Feedback number of conflicts
         if (Objects.size() - Lookup.size() > 1)   // Always 1 less in lookup because old [THIS] intentionally removed
            data->SendFeedback(Cons::Error, ProgressType::Error, 2, VString(L"Unable to process %d script objects", Objects.size()-Lookup.size()-1));
         
         // Feedback object count
         data->SendFeedback(ProgressType::Info, 2, VString(L"Loaded %d script objects", Lookup.size()));
         return Lookup.size();
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:31,代码来源:ScriptObjectLibrary.cpp

示例2: PartLineDoubleUp

VString PartLineDoubleUp(VString line, VString el, VString er){
	unsigned char *pos=line, *lpos;
	if(!rtmsu(line.endu(), el, el, pos)){ return VString(); }
	lpos=pos+=el.sz; //el.setu(pos+el.sz, line.endu()-pos-el.sz);
	if(!rtmsu(line.endu(), er, er, pos)){ return VString(); }
	return VString(lpos, pos-lpos);
}
开发者ID:mikelsv,项目名称:opensource,代码行数:7,代码来源:VString.cpp

示例3: dspacevt

VString dspacevt(VString &line, int s){ // удаление пробелов и табов s - начало конец вернуть;  1,2,4
	unsigned char *ln=line, *to=line.endu();
	if(s&1) for(ln; ln<to; ln++){ if(*ln!=' ' && *ln!='\t' ) break; }
	if(s&2) for(to; ln<to; to--){ if(*(to-1)!=' ' && *(to-1)!='\t') break; }
	if(s&4) return line=VString(ln, to-ln);
	return VString(ln, to-ln);
}
开发者ID:mikelsv,项目名称:opensource,代码行数:7,代码来源:VString.cpp

示例4: InvalidOperationException

      /// <summary>Extracts column information from a text tag</summary>
      /// <param name="tag">text tag</param>
      /// <exception cref="Logic::InvalidOperation">Not a 'text' tag</exception>
      /// <exception cref="Logic::Language::RichTextException">Invalid tag property</exception>
      void  RichStringParser::SetColumnInfo(const RichTag& tag)
      {
         // Ensure tag is 'text'
         if (tag.Type != TagType::Text)
            throw InvalidOperationException(HERE, VString(L"Cannot extract column info from a '%s' tag", ::GetString(tag.Type).c_str()) );

         // Extract properties direct into output
         for (const Property& p : tag.Properties)
         {
            // Column count
            if (p.Name == L"cols")
            {
               // Verify
               auto cols = _ttoi(p.Value.c_str());
               if (cols < 0 || cols > 3)
                  throw RichTextException(HERE, VString(L"Cannot arrange text in %d columns", cols));
               Output.Columns = static_cast<ColumnType>(cols);
            }
            // Column width
            else if (p.Name == L"colwidth")
               Output.Width = _ttoi(p.Value.c_str());
            // Column spacing
            else if (p.Name == L"colspacing")
               Output.Spacing = _ttoi(p.Value.c_str());
            else
               // Unrecognised
               throw RichTextException(HERE, VString(L"Invalid 'text' tag property '%s'", p.Name.c_str()));
         }
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:33,代码来源:RichStringParser.cpp

示例5: data

   /// <summary>Commits the document</summary>
   /// <param name="title">Revision title</param>
   /// <returns></returns>
   BOOL ScriptDocument::OnCommitDocument(const wstring& title)
   {
      WorkerData data(Operation::LoadSaveDocument);
      
      try
      {
         // Feedback
         Console << Cons::UserAction << "Committing script: " << FullPath << ENDL;
         data.SendFeedback(ProgressType::Operation, 0, VString(L"Committing script '%s'", FullPath.c_str()));

         // Get project
         auto proj = ProjectDocument::GetActive();

         // Verify document is part of project
         if (!proj)
            throw InvalidOperationException(HERE, L"No current project");
         else if (!proj->Contains(FullPath))
            throw InvalidOperationException(HERE, L"Document is not a member of current project");
         
         // Commit
         if (proj->Commit(*this, title))
            data.SendFeedback(Cons::Success, ProgressType::Succcess, 0, L"Script committed successfully");
         else
            data.SendFeedback(Cons::Error, ProgressType::Failure, 0, L"Script commit aborted");

         return TRUE;
      }
      catch (ExceptionBase&  e) 
      {
         Console.Log(HERE, e, VString(L"Failed to commit script '%s'", FullPath.c_str()));
         data.SendFeedback(Cons::Error, ProgressType::Failure, 0, L"Failed to commit script");
         return FALSE;
      }
   }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:37,代码来源:ScriptDocument.cpp

示例6: _wtoi

      /// <summary>Parses the page identifier</summary>
      /// <param name="pageid">The pageid</param>
      /// <param name="v">The associated game version</param>
      /// <returns>Normalised page ID</returns>
      /// <exception cref="Logic::InvalidValueException">Invalid pageID</exception>
      UINT  LanguageFileReader::ParsePageID(const wstring&  pageid, GameVersion&  v)
      {
         // X2: nnnn 
         if (pageid.length() <= 4)
         {
            v = GameVersion::Threat;
            return _wtoi(pageid.c_str());
         }
         // X3: NNnnnn
         else if (pageid.length() != 6)
            throw InvalidValueException(HERE, VString(L"Invalid page ID '%s'", pageid.c_str()) );

         // X3R: 30nnnn
         else if (pageid.compare(0, 2, L"30") == 0)
            v = GameVersion::Reunion;
         
         // X3TC: 35nnnn
         else if (pageid.compare(0, 2, L"35") == 0)
            v = GameVersion::TerranConflict;

         // X3AP: 38nnnn
         else if (pageid.compare(0, 2, L"38") == 0)
            v = GameVersion::AlbionPrelude;
         else
            throw InvalidValueException(HERE, VString(L"Invalid page ID '%s'", pageid.c_str()) );

         // Convert last four digits of page ID
         return _wtoi(pageid.substr(2).c_str());
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:34,代码来源:LanguageFileReader.cpp

示例7: VString

UListItem* UList<UListItem, options, tstacksize, tblocksize>::OneLine(){
	if(!size_used)
		return VString();

	if(data == data_end)
		return VString(data->data, size_used * sizeof(UListItem));

	AddBlock(size_used);

	UListData<UListItem> *p = data, *d;
	int pos = 0;

	while(p != data_end){
		memcpy(data_end->data + pos, p->data, p->size_used * sizeof(UListItem));
		pos += p->size_used;
		size_all -= p->size_all;
			
		d = p;
		p = p->next;

		if(d != (void*)stackdata)
			free(d);
	}

	data = data_end;
	data->size_used = pos;

	return data->data;
}
开发者ID:mikelsv,项目名称:opensource,代码行数:29,代码来源:UList.cpp

示例8: FindProjectDir

  /// \brief
  ///   Win32 only: finds the first directory above the passed path that contains a .project file
  /// 
  /// All other platforms return false.
  /// 
  /// This function can be used to add the project's directory as a data directory.
  /// 
  /// \param szDir
  ///   Absolute path that should be tested
  /// 
  /// \return
  ///   A VString with the project directory of the original directory if no project file present!
  ///  
  /// \note
  ///   Internally creates a temp buffer on the stack. Do not use it extensively for time critical processes.
  VBASE_IMPEXP static inline VString FindProjectDir(const char *szDir)
  {
    char szBuffer[FS_MAX_PATH];
    if(FindProjectDir(szDir, szBuffer))
      return VString(szBuffer);

    return VString(szDir);
  }
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:23,代码来源:VFileHelper.hpp

示例9: MakeAbsoluteDir

  /// \brief
  ///   Takes an input directory (NULL, "xyz", or "c:\xyz") and makes it an absolute directory by
  ///   taking the current directory into account.
  ///
  /// \param szDir
  ///   The input directory.
  /// 
  /// \return
  ///   Absolute directory (either szDir or szTmp) or an empty VString on failure.
  ///  
  /// \note
  ///   Internally creates a temp buffer on the stack. Do not use it extensively for time critical processes.
  VBASE_IMPEXP static inline VString MakeAbsoluteDir(const char *szDir)
  {
    char szBuffer[FS_MAX_PATH];
    
    if(IsAbsolutePath(szDir))
      return VString(szDir);

    MakeAbsoluteDir(szDir, szBuffer);
    return VString(szBuffer);
  }
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:22,代码来源:VFileHelper.hpp

示例10: Clear

      /// <summary>Populates the library with all the language files in the 't' subfolder</summary>
      /// <param name="vfs">The VFS to search</param>
      /// <param name="lang">The language of strings to search for</param>
      /// <param name="data">Background worker data</param>
      /// <returns>Number of files found</returns>
      UINT  StringLibrary::Enumerate(XFileSystem& vfs, GameLanguage lang, WorkerData* data)
      {
         list<XFileInfo> results;

         // Clear previous contents
         Clear();

         // Feedback
         data->SendFeedback(Cons::Heading, ProgressType::Operation, 1, VString(L"Enumerating %s language files", GetString(lang).c_str()));

         // Enumerate non-foreign language files
         for (XFileInfo& f : vfs.Browse(XFolder::Language))
         {
            LanguageFilenameReader fn(f.FullPath.FileName);

            // Add if language matches or is unspecified
            if (fn.Valid && (fn.Language == lang || !fn.HasLanguage))
               results.push_back(f);
         }

         // Read/Store each file
         for (XFileInfo& f : results)
         {
            try
            {
               // Feedback
               data->SendFeedback(ProgressType::Info, 2, VString(L"Reading language file '%s'...", f.FullPath.c_str()));
               Console << L"Reading language file: " << f.FullPath << L"...";

               // Parse language file
               LanguageFile file = LanguageFileReader(f.OpenRead()).ReadFile(f.FullPath);

               // check language tag matches filename
               if (file.Language == lang)
               {
                  Files.insert(move(file));
                  Console << Cons::Success << ENDL;
               }
               else
               {  // Skip files that turn out to be foreign
                  data->SendFeedback(ProgressType::Warning, 3, VString(L"Skipping %s language file...", GetString(file.Language).c_str()) );
                  Console << Cons::Bold << Cons::Yellow << L"Skipped" << ENDL;
               }
            }
            catch (ExceptionBase& e) {
               data->SendFeedback(Cons::Error, ProgressType::Error, 3, GuiString(L"Failed: ") + e.Message);
               
               // SkipBroken: Abort/Continue after error
               if (!PrefsLib.SkipBrokenFiles)
                  throw;
            }
         }

         return Files.size();
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:60,代码来源:StringLibrary.cpp

示例11: msrand

unsigned int msrand(unsigned int limit=S4GM){
unsigned int u, z=0; u=(unsigned int)time(0);
mscrrand.Add(VString((char*)&u, 4));
#ifndef __GNUC__
//__asm{ mov dword ptr [u] , ebp  }
#endif
mscrrand.Add(VString((char*)&u, 4));
mscrrand.Add(VString(mscrrand.cach, 16));
//mscrrand.Add(mscrrand_key);
return mscrrand.Rand(limit);
}
开发者ID:mikelsv,项目名称:opensource,代码行数:11,代码来源:mscr.cpp

示例12: VSemaphore

XBOX::VError VRemoteDebugPilot::BreakpointReached(
											WAKDebuggerContext_t	inContext,
											int						inLineNumber,
											int						inExceptionHandle,
											char*					inURL,
											int						inURLLength,
											char*					inFunction,
											int 					inFunctionLength,
											char*					inMessage,
											int 					inMessageLength,
											char* 					inName,
											int 					inNameLength,
											long 					inBeginOffset,
											long 					inEndOffset )
{

	VError	l_err = VRemoteDebugPilot::Check(inContext);
	if (!l_err)
	{
		return l_err;
	}

	bool	l_wait;
	XBOX::VSemaphore*	l_sem = new VSemaphore(0);

	l_err = ContextUpdated(inContext,l_sem,&l_wait);
	if (!l_err)
	{
		if (l_wait)
		{
			l_sem->Lock();
			VTask::Sleep(2500);
			delete l_sem;
		}
		RemoteDebugPilotMsg_t	l_msg;
		l_msg.type = BREAKPOINT_REACHED_MSG;
		l_msg.ctx = inContext;
		l_msg.linenb = inLineNumber;
		l_msg.srcid = *(intptr_t *)inURL;// we use the URL param to pass sourceId (to not modify interface of server)
		l_msg.datastr = VString( inFunction, inFunctionLength*2,  VTC_UTF_16 );
		l_msg.urlstr = VString( inMessage, inMessageLength*2,  VTC_UTF_16 );
		l_err = Send( l_msg );
	}
	VString l_trace = VString("VRemoteDebugPilot::BreakpointReached ctx activation pb for ctxid=");
	l_trace.AppendLong8((unsigned long long)inContext);
	l_trace += " ,ok=";
	l_trace += (!l_err ? "1" : "0" );
	sPrivateLogHandler->Put( (l_err ? WAKDBG_ERROR_LEVEL : WAKDBG_INFO_LEVEL),l_trace);

	return l_err;
}
开发者ID:sanyaade-mobiledev,项目名称:core-XToolbox,代码行数:51,代码来源:VRemoteDebugPilot.cpp

示例13: ComException

      /// <summary>Loads game data</summary>
      /// <param name="data">arguments.</param>
      /// <returns></returns>
      DWORD WINAPI GameDataWorker::ThreadMain(GameDataWorkerData* data)
      {
         try
         {
            XFileSystem vfs;
            HRESULT  hr;

            // Init COM
            if (FAILED(hr=CoInitialize(NULL)))
               throw ComException(HERE, hr);

            // Feedback
            Console << Cons::UserAction << L"Loading " << VersionString(data->Version) << L" game data from " << data->GameFolder << ENDL;
            data->SendFeedback(ProgressType::Operation, 0, VString(L"Loading %s game data from '%s'", VersionString(data->Version).c_str(), data->GameFolder.c_str()));

            // Build VFS. 
            vfs.Enumerate(data->GameFolder, data->Version, data);

            // language files
            StringLib.Enumerate(vfs, data->Language, data);

            // script/game objects
            ScriptObjectLib.Enumerate(data);
            GameObjectLib.Enumerate(vfs, data);

            // Descriptions
            DescriptionLib.Enumerate(data);

            // legacy syntax file
            SyntaxLib.Enumerate(data);

            // Cleanup
            data->SendFeedback(Cons::UserAction, ProgressType::Succcess, 0, VString(L"Loaded %s game data successfully", VersionString(data->Version).c_str()));
            CoUninitialize();
            return 0;
         }
         catch (ExceptionBase& e)
         {
            // Feedback
            Console.Log(HERE, e);
            Console << ENDL;
            data->SendFeedback(Cons::Error, ProgressType::Failure, 0, GuiString(L"Failed to load game data : ") + e.Message);

            // BEEP!
            MessageBeep(MB_ICONERROR);

            // Cleanup
            CoUninitialize();
            return 0;
         }
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:54,代码来源:GameDataWorker.cpp

示例14: V3D_THROW

IVDirectory* VSimpleVfs::GetDir(VStringParam in_strDir)
{
	if( in_strDir[0] != '/' )
	{
		V3D_THROW(VIOException, "paths must start with '/', \""
			+ VString(in_strDir) + "\" is illegal"
			);
	}

	IVDirectory* pCurrDir = m_pRootDirSP.Get();

	std::string pathAndName = in_strDir;
	std::string::iterator pos = pathAndName.begin();
	std::string::iterator substrEnd = pos;
	const std::string::iterator end(pathAndName.end());
	std::string currDirName = "/";
	std::string fileName;

	while((substrEnd = std::find(++pos, end, '/')) != end)
	{		
		// get current dir name
		currDirName.assign(pos, substrEnd);

		// find it in current directory
		VDirectory::DirIter nextDir = pCurrDir->SubDirs();
		VDirectory* tmp = (VDirectory*)&(*nextDir);
		VCompareFSOName fsoCmp(currDirName);
		while( nextDir.HasNext() )
		{
			if( fsoCmp(*nextDir) ) break;
			++nextDir;
		}

		if( !nextDir.HasNext() )
		{
			V3D_THROW(VIOException, "could not find directory \"" 
				+ VString(currDirName.c_str()) + "\"");
		}

		pCurrDir = &(*nextDir);

		pos = substrEnd;
	}

	fileName.assign(pos, substrEnd);

	// return dir
	return pCurrDir;
}
开发者ID:sheijk,项目名称:Velox3D,代码行数:49,代码来源:VSimpleVfs.cpp

示例15: switch

      /// <summary>Reads the unix style colour code and advances the iterator</summary>
      /// <param name="pos">position of backslash</param>
      /// <returns></returns>
      /// <exception cref="Logic::AlgorithmException">Previously matched colour code is unrecognised</exception>
      /// <remarks>Advances the iterator to the last character of the tag, so Parse() loop advances correctly to the next character</remarks>
      Colour  RichStringParser::ReadColourCode(CharIterator& pos)
      {
         Colour c;

         // Match colour character
         switch (pos[4])
         {
         case 'A':   c = Colour::Silver;  break;
         case 'B':   c = Colour::Blue;    break;
         case 'C':   c = Colour::Cyan;    break;
         case 'G':   c = Colour::Green;   break;
         case 'O':   c = Colour::Orange;  break;
         case 'M':   c = Colour::Purple;  break;
         case 'R':   c = Colour::Red;     break;
         case 'W':   c = Colour::White;   break;
         case 'X':   c = Colour::Default; break;
         case 'Y':   c = Colour::Yellow;  break;
         case 'Z':   c = Colour::Black;   break;
         default:
            throw AlgorithmException(HERE, VString(L"Previously matched colour code '%c' is unrecognised", *pos));
         }

         // Consume + return colour
         pos += 4;
         return c;
      }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:31,代码来源:RichStringParser.cpp


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