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


C++ TStrV类代码示例

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


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

示例1: EscapableHandleScope

v8::Local<v8::Value> TNodeJsUtil::GetStrArr(const TStrV& StrV) {
    v8::Isolate* Isolate = v8::Isolate::GetCurrent();
    v8::EscapableHandleScope EscapableHandleScope(Isolate);
    v8::Local<v8::Array> JsStrV = v8::Array::New(Isolate, StrV.Len());
    for (int StrN = 0; StrN < StrV.Len(); StrN++) {
        JsStrV->Set(StrN, v8::String::NewFromUtf8(Isolate, StrV[StrN].CStr()));
    }
    return EscapableHandleScope.Escape(JsStrV);
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:9,代码来源:nodeutil.cpp

示例2: while

int TTransCorpus::CountWords(const TIntStrH& StrH) {
    int Words = 0, KeyId = StrH.FFirstKeyId();
    while (StrH.FNextKeyId(KeyId)) {
        const TStr& Str = StrH[KeyId];
        TStrV WordV; Str.SplitOnWs(WordV);
        Words += WordV.Len();
    }
    return Words;
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:9,代码来源:biling.cpp

示例3: LoadFromFile

void TSwSet::LoadFromFile(const TStr& FNm) {
    TStr FileStr = TStr::LoadTxt(FNm);
    FileStr.DelChAll('\r');
    TStrV WordV; FileStr.SplitOnAllCh('\n', WordV);
    for (int WordN = 0; WordN < WordV.Len(); WordN++) {
        const TStr& WordStr = WordV[WordN];
        if (!IsIn(WordStr)) { AddWord(WordStr); }
    }
}
开发者ID:edgeflip,项目名称:dmoz,代码行数:9,代码来源:stopword.cpp

示例4: DelWc

void TFile::DelWc(const TStr& WcStr, const bool& RecurseDirP){
  // collect file-names
  TStrV FNmV;
  TFFile FFile(WcStr, RecurseDirP); TStr FNm;
  while (FFile.Next(FNm)){
    FNmV.Add(FNm);}
  // delete files
  for (int FNmN=0; FNmN<FNmV.Len(); FNmN++){
    Del(FNmV[FNmN], false);}
}
开发者ID:Accio,项目名称:snap,代码行数:10,代码来源:flx.cpp

示例5: GetVoidItemIdV

void TAmazonItemBs::GetVoidItemIdV(TStrV& VoidItemIdV) const {
  VoidItemIdV.Clr();
  for (int ItemIdN=0; ItemIdN<GetItems(); ItemIdN++){
    PAmazonItem Item=GetItem(ItemIdN);
    for (int NextItemIdN=0; NextItemIdN<Item->GetNextItemIds(); NextItemIdN++){
      TStr NextItemId=Item->GetNextItemId(NextItemIdN);
      if (!IsItem(NextItemId)){VoidItemIdV.AddUnique(NextItemId);}
    }
  }
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:10,代码来源:amazon.cpp

示例6: TStrV

TStrV TTable::GetEdgeStrAttrV() const {
  TStrV StrEA = TStrV(StrColMaps.Len(),0);
  for (int i = 0; i < EdgeAttrV.Len(); i++) {
    TStr Attr = EdgeAttrV[i];
    if (GetColType(Attr) == STR) {
      StrEA.Add(Attr);
    }
  }
  return StrEA;
}
开发者ID:nikhilkhadke,项目名称:snapr,代码行数:10,代码来源:Table.cpp

示例7: GetBackupFolders

// return the list of folders containing backups for a given profile name
// folders are sorted from the oldest to the newest
void TFolderBackup::GetBackupFolders(const TStr& ProfileName, TStrV& FolderNmV) const
{
    FolderNmV.Clr();
    if (ProfileH.IsKey(ProfileName)) {
        TBackupProfile Profile = ProfileH.GetDat(ProfileName);
        const TVec<TBackupLogInfo>& LogV = Profile.GetLogs();
        for (int N = 0; N < LogV.Len(); N++)
            FolderNmV.Add(LogV[N].GetFolderName());
    }
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:12,代码来源:folderbackup.cpp

示例8: GetNGramStrV

void TNGramBs::GetNGramStrV(
 const TStr& HtmlStr, TStrV& NGramStrV, TIntPrV& NGramBEChXPrV) const {
  TIntV NGramIdV; NGramStrV.Clr(); NGramBEChXPrV.Clr();
  TNGramBs::GetNGramIdV(HtmlStr, NGramIdV, NGramBEChXPrV);
  NGramStrV.Gen(NGramIdV.Len(), 0);
  for (int NGramIdN=0; NGramIdN<NGramIdV.Len(); NGramIdN++){
    TStr NGramStr=GetNGramStr(NGramIdV[NGramIdN]);
    NGramStrV.Add(NGramStr);
  }
}
开发者ID:bergloman,项目名称:qminer,代码行数:10,代码来源:phrase.cpp

示例9: GetObjHdNmV

void TExpHelp::GetObjHdNmV(const TStr& CatNm, TStrV& ObjHdNmV) const {
  ObjHdNmV.Clr();
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    TStr ObjCatNm=ObjV[ObjN]->GetCatNm();
    TStr ObjHdNm=ObjV[ObjN]->GetHdItem()->GetNm();
    if ((CatNm.Empty())||(CatNm=="All")||(CatNm==ObjCatNm)){
      ObjHdNmV.AddUnique(ObjHdNm);}
  }
  ObjHdNmV.Sort();
}
开发者ID:Accio,项目名称:snap,代码行数:10,代码来源:exp.cpp

示例10: FFile

PBowDocBs TBowFl::LoadReuters21578Txt(
 const TStr& FPath, const int& MxDocs,
 const TStr& SwSetTypeNm, const TStr& StemmerTypeNm,
 const int& MxNGramLen, const int& MnNGramFq, const bool& SaveDocP,
 const PNotify& Notify){
  // prepare stop-words
  PSwSet SwSet=TSwSet::GetSwSet(SwSetTypeNm);
  // prepare stemmer
  PStemmer Stemmer=TStemmer::GetStemmer(StemmerTypeNm);
  // create ngrams
  PNGramBs NGramBs;
  if (!((MxNGramLen==1)&&(MnNGramFq==1))){
    NGramBs=TNGramBs::GetNGramBsFromReuters21578(
     FPath, MxDocs,
     MxNGramLen, MnNGramFq, SwSet, Stemmer);
  }
  // create document-base
  PBowDocBs BowDocBs=TBowDocBs::New(SwSet, Stemmer, NGramBs);
  // traverse directory
  TFFile FFile(FPath, ".SGM", false); TStr FNm; int Docs=0;
  while (FFile.Next(FNm)){
    printf("Processing file '%s'\n", FNm.CStr());
    TIntH DocWIdToFqH(100);
    TXmlDocV LDocV; TXmlDoc::LoadTxt(FNm, LDocV);
    for (int LDocN=0; LDocN<LDocV.Len(); LDocN++){
      Docs++; if (Docs%100==0){printf("%d\r", Docs);}
      if ((MxDocs!=-1)&&(Docs>=MxDocs)){break;}
      // get document-name
      PXmlDoc Doc=LDocV[LDocN];
      PXmlTok DocTok=Doc->GetTok();
      TStr DocNm=DocTok->GetArgVal("NEWID");
      // get document-categories
      TStrV CatNmV;
      TXmlTokV TopicsTokV; Doc->GetTagTokV("REUTERS|TOPICS|D", TopicsTokV);
      for (int TopicsTokN=0; TopicsTokN<TopicsTokV.Len(); TopicsTokN++){
        TStr CatNm=TopicsTokV[TopicsTokN]->GetTokStr(false);
        CatNmV.Add(CatNm);
      }
      // get document-contents
      PXmlTok DocStrTok=Doc->GetTagTok("REUTERS|TEXT");
      TStr DocStr=DocStrTok->GetTokStr(false);
      // add document to bow
      int DId=BowDocBs->AddHtmlDoc(DocNm, CatNmV, DocStr, SaveDocP);
      // train & test data
      if ((DocTok->GetArgVal("LEWISSPLIT")=="TRAIN")&&(DocTok->GetArgVal("TOPICS")=="YES")){
        BowDocBs->AddTrainDId(DId);}
      if ((DocTok->GetArgVal("LEWISSPLIT")=="TEST")&&(DocTok->GetArgVal("TOPICS")=="YES")){
        BowDocBs->AddTestDId(DId);}
    }
    if ((MxDocs!=-1)&&(Docs>=MxDocs)){break;}
  }
  // return results
  BowDocBs->AssertOk();
  return BowDocBs;
}
开发者ID:Accio,项目名称:snap,代码行数:55,代码来源:bowflx.cpp

示例11: GetFNmV

void TFFile::GetFNmV(
 const TStr& FPath, const TStrV& FExtV, const bool& RecurseP, TStrV& FNmV){
  // prepare file-directory traversal
  TStrV FPathV; FPathV.Add(FPath);
  TFFile FFile(FPathV, FExtV, "", RecurseP); TStr FNm;
  // traverse directory
  FNmV.Clr();
  while (FFile.Next(FNm)){
    FNmV.Add(FNm);
  }
}
开发者ID:SherlockYang,项目名称:Archive,代码行数:11,代码来源:xfl.cpp

示例12: GetVarNmV

void TEnv::GetVarNmV(TStrV& VarNmV) {
    VarNmV.Clr();
    int VarN=0;
    while (_environ[VarN]!=NULL) {
        TStr VarNmVal=_environ[VarN++];
        TStr VarNm;
        TStr VarVal;
        VarNmVal.SplitOnCh(VarNm, '=', VarVal);
        VarNmV.Add(VarNm);
    }
}
开发者ID:josthkko,项目名称:qminer,代码行数:11,代码来源:env.cpp

示例13: Update

void TFtrGenBs::Update(const TStrV& FtrValV) {
	EAssert(State == fgsUpdate);
	EAssert(FtrValV.Len() == FtrGenV.Len());
	try {
		for (int FtrValN = 0; FtrValN < FtrValV.Len(); FtrValN++) {
			FtrGenV[FtrValN]->Update(FtrValV[FtrValN]);
		}
	} catch (PExcept Ex) {
		TExcept::Throw(TStr::Fmt("Error feature generation: '%s'!", Ex->GetMsgStr().CStr()));
	}
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:11,代码来源:ftrgen.cpp

示例14: Add

void TFtrGenSparseNumeric::Add(const TStr& Str, TIntFltKdV& SpV, int& Offset) const {
    TStrV EltV; Str.SplitOnAllCh(';', EltV); TIntH UsedIdH;
    for (int EltN = 0; EltN < EltV.Len(); EltN++) {
        int Id; TStr Val; Split(EltV[EltN], Id, Val);
        EAssertR(!UsedIdH.IsKey(Id), "Field ID repeated in '" + Str + "'!");
        int TmpOffset = Offset + Id;
        FtrGen->Add(Val, SpV, TmpOffset);
        UsedIdH.AddKey(Id);
    }
    Offset += GetVals();
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:11,代码来源:ftrgen.cpp

示例15: EAssert

// copy files for a particular folder info
void TBackupProfile::CopyFolder(const TStr& BaseTargetFolder, const TStr& SourceFolder, const TStrV& Extensions, const TStrV& SkipIfContainingV, const bool& IncludeSubfolders, const bool& ReportP, TStr& ErrMsg)
{
    try {
        // get the name of the source folder
        TStrV PathV; TDir::SplitPath(SourceFolder, PathV);
        EAssert(PathV.Len() > 0);

        // create the folder in the base target folder
        TStr TargetFolder = BaseTargetFolder + PathV[PathV.Len() - 1] + "/";
        if (!TDir::Exists(TargetFolder))
            TDir::GenDir(TargetFolder);

        // find files to be copied
        TStrV FileV;
        TFFile::GetFNmV(SourceFolder, Extensions, false, FileV);

        TStrV FolderV;
        // copy them
        for (int N = 0; N < FileV.Len(); N++) {
            // we found a file
            if (TFile::Exists(FileV[N])) {
                const TStr FileName = TDir::GetFileName(FileV[N]);
                // is this a file that we wish to ignore?
                bool ShouldCopy = true;
                for (int S = 0; S < SkipIfContainingV.Len(); S++) {
                    if (FileName.SearchStr(SkipIfContainingV[S]) >= 0)
                        ShouldCopy = false;
                }
                if (!ShouldCopy)
                    continue;
                const TStr TargetFNm = TargetFolder + FileName;
                if (ReportP)
                    TNotify::StdNotify->OnStatusFmt("Copying file: %s\r", FileName.CStr());
                TFile::Copy(FileV[N], TargetFNm);
            }
            // we found a folder
            else {
                FolderV.Add(FileV[N]);
            }
        }

        if (IncludeSubfolders) {
            for (int N = 0; N < FolderV.Len(); N++)
                CopyFolder(TargetFolder, FolderV[N], Extensions, SkipIfContainingV, IncludeSubfolders, ReportP, ErrMsg);
        }
    }
    catch (PExcept E) {
        if (ErrMsg != "")
            ErrMsg += "\n";
        ErrMsg += "Exception while copying from " + SourceFolder + ": " + E->GetMsgStr();
    }
    catch (...) {
        if (ErrMsg != "")
            ErrMsg += "\n";
        ErrMsg += "Exception while copying from " + SourceFolder + ": " + "Unrecognized exception occured.";
    }
}
开发者ID:Bradeskojest,项目名称:qminer,代码行数:58,代码来源:folderbackup.cpp


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