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


C++ TStrV::Clr方法代码示例

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


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

示例1: GetVarNmValV

void TEnv::GetVarNmValV(TStrV& VarNmValV) {
    VarNmValV.Clr();
    int VarN = 0;
    while (_environ[VarN] != NULL) {
        VarNmValV.Add(_environ[VarN++]);
    }
}
开发者ID:zzjjzzgggg,项目名称:netsnap,代码行数:7,代码来源:env.cpp

示例2: GetStdNameV

void TStrUtil::GetStdNameV(TStr AuthorNames, TStrV& StdNameV) {
  AuthorNames.ChangeChAll('\n', ' ');
  AuthorNames.ToLc();
  // split into author names
  TStrV AuthV, TmpV, Tmp2V;
  // split on 'and'
  AuthorNames.SplitOnStr(" and ", TmpV);
  int i;
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(',', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on '&'
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh('&', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on ','
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(',', Tmp2V);  AuthV.AddV(Tmp2V); }
  // split on ';'
  TmpV = AuthV;  AuthV.Clr();
  for (i = 0; i < TmpV.Len(); i++) {
    TmpV[i].SplitOnAllCh(';', Tmp2V);  AuthV.AddV(Tmp2V); }
  // standardize names
  StdNameV.Clr();
  //printf("\n*** %s\n", AuthorNames.CStr());
  for (i = 0; i < AuthV.Len(); i++) {
    TStr StdName = GetStdName(AuthV[i]);
    if (! StdName.Empty()) {
      //printf("\t%s  ==>  %s\n", AuthV[i].CStr(), StdName.CStr());
      StdNameV.Add(StdName);
    }
  }
}
开发者ID:SherlockYang,项目名称:Archive,代码行数:33,代码来源:util.cpp

示例3: GetValV

void TFtrGenMultiNom::GetValV(const TStr& Str, TStrV& ValV) const {
    TStrV EltV; Str.SplitOnAllCh(';', EltV); ValV.Clr();
    for (int EltN = 0; EltN < EltV.Len(); EltN++) {
        const TStr& Val = EltV[EltN];
        TStrV SubValV; FtrGen->GetValV(Val, SubValV);
        ValV.AddV(SubValV);
    }
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:8,代码来源:ftrgen.cpp

示例4: GetFldValV

void TSAppSrvFun::GetFldValV(const TStrKdV& FldNmValPrV, const TStr& FldNm, TStrV& FldValV) {
	FldValV.Clr();
	int ValN = FldNmValPrV.SearchForw(TStrKd(FldNm, ""));
	while (ValN != -1) {
		FldValV.Add(FldNmValPrV[ValN].Dat);
		ValN = FldNmValPrV.SearchForw(TStrKd(FldNm, ""), ValN + 1);
	}
}
开发者ID:Austindeadhead,项目名称:qminer,代码行数:8,代码来源:sappsrv.cpp

示例5: GetCatNmV

void TExpHelp::GetCatNmV(TStrV& CatNmV) const {
  CatNmV.Clr();
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    TStr CatNm=ObjV[ObjN]->GetCatNm();
    CatNmV.AddUnique(CatNm);
  }
  CatNmV.Ins(0, "All");
}
开发者ID:Accio,项目名称:snap,代码行数:8,代码来源:exp.cpp

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: GetNGramStrV

void TNytNGramBs::GetNGramStrV(const TStr& HtmlStr, TStrV& NGramStrV){
  NGramStrV.Clr();
  // prepare html parsing
  PSIn HtmlSIn=TStrIn::New(HtmlStr);
  THtmlLx HtmlLx(HtmlSIn);
  // process text
  TStrV StrV;
  while (HtmlLx.GetSym()!=hsyEof){
    TStr Str=HtmlLx.ChA;
    Str.ToLc();
    switch (HtmlLx.Sym){
      case hsyUndef:
      case hsyUrl:
      case hsyMTag:
      case hsySSym:
        StrV.Clr();
        break;
      case hsyStr:
      case hsyNum:
        NGramStrV.Add(Str);
        StrV.Add(Str);
        for (int NGramLen=2; NGramLen<=4; NGramLen++){
          if (StrV.Len()<NGramLen){break;}
          TStrV TermStrV(NGramLen, 0);
          for (int StrN=StrV.Len()-NGramLen; StrN<StrV.Len(); StrN++){
            TermStrV.Add(StrV[StrN]);
          }
          int NGramId;
          if (IsNGram(TermStrV, NGramId)){
            TStr NGramStr=GetNGramStr(NGramId);
            NGramStrV.Add(NGramStr);
          }
        } 
        break;
      case hsyBTag:
      case hsyETag:
        StrV.Clr();
        break;
      case hsyEof: break;
      default: Fail;
    }
  }
}
开发者ID:Accio,项目名称:snap,代码行数:43,代码来源:nytngrams.cpp

示例11: 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

示例12: 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

示例13: SaveTxt

void TTransCorpus::SaveTxt(const TStr& OutFBase, const TStr& OutOrgFNm, 
        const TStr& OutTransFNm, const TStr& OutRefTransFNm, TStrV& OrgFNmV, 
        TStrV& TransFNmV, TStrV& RefTransFNmV, const int& LinesPerFile) {
    
    // prepare filenames
    OrgFNmV.Clr(); TransFNmV.Clr(); RefTransFNmV.Clr();
    if (!OutOrgFNm.Empty()) { OrgFNmV.Add(GetOutFNm(OutFBase, 0, LinesPerFile, OutOrgFNm)); }
    if (!OutTransFNm.Empty()) { TransFNmV.Add(GetOutFNm(OutFBase, 0, LinesPerFile, OutTransFNm)); }
    if (!OutRefTransFNm.Empty()) { RefTransFNmV.Add(GetOutFNm(OutFBase, 0, LinesPerFile, OutRefTransFNm)); }
    // open files
    PSOut OrgSOut = !OutOrgFNm.Empty() ? TFOut::New(OrgFNmV.Last()) : PSOut();
    PSOut TransSOut = !OutTransFNm.Empty() ? TFOut::New(TransFNmV.Last()) : PSOut();
    PSOut RefTransSOut = !OutRefTransFNm.Empty() ? TFOut::New(RefTransFNmV.Last()) : PSOut();
    // check which are given
    const bool IsOrgP = !OrgSOut.Empty() && IsOrg();
    const bool IsTransP = !TransSOut.Empty() && IsTrans();
    const bool IsRefTransP = !RefTransSOut.Empty() && IsRefTrans();
    // print warnings
    if (!IsOrgP) { printf("No original sentences!\n"); }
    if (!IsTransP) { printf("No machine translation sentences!\n"); }
    if (!IsRefTransP) { printf("No reference translation sentences!\n"); }
    // go over all the sentences and store them in the file
    TIntV SentIdV; GetSentIdV(SentIdV);
    for (int SentIdN = 0; SentIdN < SentIdV.Len(); SentIdN++) {
        const int SentId = SentIdV[SentIdN];
        if (IsOrgP) { OrgSOut->PutStrLn(GetOrgStr(SentId)); }
        if (IsTransP) { TransSOut->PutStrLn(GetTransStr(SentId)); }
        if (IsRefTransP) { RefTransSOut->PutStrLn(GetRefTransStrV(SentId)[0]); }
        // should we break and go to next file?
        if ((LinesPerFile!=-1) && (SentIdN>0) && (SentIdN % LinesPerFile == 0)) {
            // prepare filenames
            if (!OutOrgFNm.Empty()) { OrgFNmV.Add(GetOutFNm(OutFBase, SentIdN, LinesPerFile, OutOrgFNm)); }
            if (!OutTransFNm.Empty()) { TransFNmV.Add(GetOutFNm(OutFBase, SentIdN, LinesPerFile, OutTransFNm)); }
            if (!OutRefTransFNm.Empty()) { RefTransFNmV.Add(GetOutFNm(OutFBase, SentIdN, LinesPerFile, OutRefTransFNm)); }
            // open next files files
            OrgSOut = !OutOrgFNm.Empty() ? TFOut::New(OrgFNmV.Last()) : PSOut();
            TransSOut = !OutTransFNm.Empty() ? TFOut::New(TransFNmV.Last()) : PSOut();
            RefTransSOut = !OutRefTransFNm.Empty() ? TFOut::New(RefTransFNmV.Last()) : PSOut();
        }
    }
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:41,代码来源:biling.cpp

示例14: Tokenize

/////////////////////////////////////////////////
// Translation-Evaluation-Scores
void TEvalScore::Tokenize(const TStr& Str, TStrV& TokenV) {
    TStr LcStr = GetLc(Str);
    TokenV.Clr(); TChA WordChA; 
    const int Chs = LcStr.Len();
    for (int ChN = 0; ChN < Chs; ChN++) {
        const char Ch = LcStr[ChN];
        if (IsChar(Ch)) { 
            WordChA += Ch; 
        } else if (!WordChA.Empty()) {
            TokenV.Add(WordChA);
            WordChA.Clr();
        }
    }        
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:16,代码来源:biling.cpp

示例15: main

int main(){
  TTableContext Context;
  // Case 1: Euclidean Distance
  Schema BuildingS;
  BuildingS.Add(TPair<TStr,TAttrType>("Building", atStr));
  BuildingS.Add(TPair<TStr,TAttrType>("X", atInt));
  BuildingS.Add(TPair<TStr,TAttrType>("Y", atInt));

  // create table
  PTable TBuildings = TTable::LoadSS("Buildings", BuildingS, "tests/buildings.txt", Context, '\t', false);

	TStrV Cols;
	Cols.Add("X");
	Cols.Add("Y");

	// Find all buildings within 5 Euc Distance of each other.
	PTable BuildingJointTable = TBuildings->SelfSimJoin(Cols, "Euclidean_Distance", L2Norm, 5.0);
	BuildingJointTable->SaveSS("tests/buildings.out.txt");

  // Case2 : Haversine distance 
  Schema PlaceS;
  PlaceS.Add(TPair<TStr,TAttrType>("Name", atStr));
  PlaceS.Add(TPair<TStr,TAttrType>("Location", atStr));
  PlaceS.Add(TPair<TStr,TAttrType>("Latitude", atFlt));
  PlaceS.Add(TPair<TStr,TAttrType>("Longitude", atFlt));

  // create table
  PTable TPlaces = TTable::LoadSS("Places", PlaceS, "tests/places.txt", Context, '\t', false);

	Cols.Clr();
	Cols.Add("Latitude");
	Cols.Add("Longitude");

	PTable PlacesJointTable = TPlaces->SelfSimJoin(Cols, "Distance",Haversine, 1000.0);

	TStrV ProjectionV;
	ProjectionV.Add("Places_1.Name");
	ProjectionV.Add("Places_1.Location");	
	ProjectionV.Add("Places_2.Name");
	ProjectionV.Add("Places_2.Location");
	ProjectionV.Add("Distance");
	PlacesJointTable->ProjectInPlace(ProjectionV);
	PlacesJointTable->SelectAtomic("Places_1.Name", "Places_2.Name", NEQ);
	PlacesJointTable->SaveSS("tests/places.out.txt");

	printf("Saved buildings.out.txt and places.out.txt\n");
  return 0;
}
开发者ID:FanBit,项目名称:snapr,代码行数:48,代码来源:SimJoinTest.cpp


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