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


C++ TStr函数代码示例

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


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

示例1: switch

TStr TNotify::GetTypeStr(
 const TNotifyType& Type, const bool& Brief){
  static TStr InfoSStr="I"; static TStr InfoLStr="Information";
  static TStr WarnSStr="W"; static TStr WarnLStr="Warning";
  static TStr ErrSStr="E"; static TStr ErrLStr="Error";
  static TStr StatSStr=""; static TStr StatLStr="Status";
  switch (Type){
    case ntInfo: if (Brief){return InfoSStr;} else {return InfoLStr;}
    case ntWarn: if (Brief){return WarnSStr;} else {return WarnLStr;}
    case ntErr: if (Brief){return ErrSStr;} else {return ErrLStr;}
    case ntStat: if (Brief){return StatSStr;} else {return StatLStr;}
    default: Fail; return TStr();
  }
}
开发者ID:Aleyasen,项目名称:Alaki,代码行数:14,代码来源:ut.cpp

示例2: TEST

TEST(TNEANet, GetSAttrIdN) {
  PNEANet Graph;
  Graph = TNEANet::New();
  TInt AttrId;
  Graph->AddSAttrN("TestInt", atInt, AttrId);
  Graph->AddSAttrN("TestFlt", atFlt, AttrId);
  Graph->AddSAttrN("TestStr", atStr, AttrId);
  TAttrType AttrType;
  int status = Graph->GetSAttrIdN(TStr("TestInt"), AttrId, AttrType);
  EXPECT_EQ(0, status);
  EXPECT_EQ(atInt, AttrType);
  EXPECT_EQ(0, AttrId.Val);
  status = Graph->GetSAttrIdN(TStr("TestFlt"), AttrId, AttrType);
  EXPECT_EQ(0, status);
  EXPECT_EQ(atFlt, AttrType);
  EXPECT_EQ(1, AttrId.Val);
  status = Graph->GetSAttrIdN(TStr("TestStr"), AttrId, AttrType);
  EXPECT_EQ(0, status);
  EXPECT_EQ(atStr, AttrType);
  EXPECT_EQ(2, AttrId.Val);
  status = Graph->GetSAttrIdN(TStr("TestError"), AttrId, AttrType);
  EXPECT_EQ(-1, status);
}
开发者ID:IsmaelAli,项目名称:snap,代码行数:23,代码来源:test-TNEANet.cpp

示例3: Assert

int TBTb::AddTup(const TStr& Nm){
  Assert(GetVars()>0);
  TStr UniqNm=Nm;
  if (UniqNm.Empty()){UniqNm=TStr("E")+TInt::GetStr(TupV.Len());}
  if (TupNmToNH.IsKey(UniqNm)){
    int CopyN=2;
    while (TupNmToNH.IsKey(UniqNm+" ("+TInt::GetStr(CopyN)+")")){CopyN++;}
    UniqNm=UniqNm+" ("+TInt::GetStr(CopyN)+")";
  }
  Assert(!TupNmToNH.IsKey(UniqNm));
  int TupN=0;//TupV.Add(PTbTup(new TBTbTup(UniqNm, GetVars())));
  TupNmToNH.AddDat(UniqNm, TupN);
  return TupN;
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:14,代码来源:tb.cpp

示例4: l

void TSession::SaveValue(
	const TStr &Cookie,
	const TStr &Name,
	TSessionValue *p)
{
	TStr s;
	m_ssi::TStringList sl;
	p->SaveValues(sl);
	for( int i = 0; i < sl.Count(); i++ )
	{
		TStr l(sl.Names(i) + "=" + sl.Values(i));
		s += TStr(l.Length()) + "-" + l;
	}
	SaveValue(Cookie,Name,s.c_str(),s.Length());
}
开发者ID:tsdv-candd,项目名称:gameserver,代码行数:15,代码来源:mCommon.cpp

示例5: HandleScope

void TNodeJsUtil::ExecuteVoid(const v8::Handle<v8::Function>& Fun,
		const v8::Local<v8::Object>& Arg1, const v8::Local<v8::Object>& Arg2) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);
	v8::TryCatch TryCatch;

	const int ArgC = 2;
	v8::Handle<v8::Value> ArgV[ArgC] = { Arg1, Arg2 };
	Fun->Call(Isolate->GetCurrentContext()->Global(), 2, ArgV);

	if (TryCatch.HasCaught()) {
		v8::String::Utf8Value Msg(TryCatch.Message()->Get());
		throw TExcept::New("Exception while executing VOID: " + TStr(*Msg));
	}
}
开发者ID:amrsobhy,项目名称:qminer,代码行数:15,代码来源:nodeutil.cpp

示例6: GetPlotInfo

void TGStat::Plot(const TGStatDistr& Distr, const TStr& FNmPref, TStr Desc, bool PowerFit) const {
  if (Desc.Empty()) Desc = FNmPref.GetUc();
  if (! HasDistr(Distr) || Distr==gsdUndef || Distr==gsdMx) { return; }
  TPlotInfo Info = GetPlotInfo(Distr);
  TGnuPlot GnuPlot(Info.Val1+TStr(".")+FNmPref, TStr::Fmt("%s. G(%d, %d)", Desc.CStr(), GetNodes(),GetEdges()));
  GnuPlot.SetXYLabel(Info.Val2, Info.Val3);
  GnuPlot.SetScale(Info.Val4);
  const int plotId = GnuPlot.AddPlot(GetDistr(Distr), gpwLinesPoints, "");
  if (PowerFit) { GnuPlot.AddPwrFit(plotId, gpwLines); }
  #ifdef GLib_MACOSX
  GnuPlot.SaveEps();
  #else
  GnuPlot.SavePng();
  #endif
}
开发者ID:Accio,项目名称:snap,代码行数:15,代码来源:gstat.cpp

示例7: Err

/// For every quote, add it to corresponding bucket for each hashed x-character shingle of the quote
// (Shingles by characters)
void LSH::HashShingles(TQuoteBase *QuoteBase, TClusterBase *CB, TInt ShingleLen,
    THash<TMd5Sig, TShingleIdSet>& ShingleToQuoteIds) {
  Err("Hashing shingles...\n");
  TIntV QuoteIds;
  QuoteBase->GetAllQuoteIds(QuoteIds);
  for (int qt = 0; qt < QuoteIds.Len(); qt++) {
    if (qt % 1000 == 0) {
      fprintf(stderr, "%d out of %d completed\n", qt, QuoteIds.Len());
    }

    if (CB->IsQuoteInArchivedCluster(QuoteIds[qt]))
      continue;
    TQuote Q;
    QuoteBase->GetQuote(QuoteIds[qt], Q);

    // Put x-character (or x-word) shingles into hash table; x is specified by ShingleLen parameter
    TStr QContentStr;
    Q.GetParsedContentString(QContentStr);
    TChA QContentChA = TChA(QContentStr);

    int CurWord = 0;

    for (int i = 0; i < QContentChA.Len() - ShingleLen + 1; i++) {
      TChA ShingleChA = TChA();
      for (int j = 0; j < ShingleLen; j++) {
        ShingleChA.AddCh(QContentChA.GetCh(i + j));
      }
      TStr Shingle = TStr(ShingleChA);
      const TMd5Sig ShingleMd5(Shingle);
      TShingleIdSet ShingleQuoteIds;
      if (ShingleToQuoteIds.IsKey(ShingleMd5)) {
        ShingleQuoteIds = ShingleToQuoteIds.GetDat(ShingleMd5);
      }

      for (int j = CurWord; j > CurWord - WordWindow && j >= 0; j--) {
        ShingleQuoteIds.AddKey(TShingleId(QuoteIds[qt], j));
      }

      ShingleToQuoteIds.AddDat(ShingleMd5, ShingleQuoteIds);

      // up the current word index if we see a space
      if (QContentChA.GetCh(i + ShingleLen - 1) == ' ') {
        CurWord++;
      }
    }
  }
  Err("Done hashing!\n");
}
开发者ID:snap-stanford,项目名称:curis-2012,代码行数:50,代码来源:lsh.cpp

示例8: switch

TStr TTsMd::GetTsMdEstDNm(const TTsMdEst& Est){
  switch (Est){
    case tmeAcc: return "Accuracy";
    case tmePrbAcc: return "Probability-Accuracy";
    case tmeInfScore: return "Information-Score";
    case tmeGeoPrecision: return "Geometric-Precision";
    case tmeGeoRecall: return "Geometric-Recall";
    case tmePrecision: return "Precision";
    case tmeRecall: return "Recall";
    case tmePrbPrecision: return "Probability-Precision";
    case tmePrbRecall: return "Probability-Recall";
    case tmeSec: return "Square-Error-In-Counting";
    case tmeF2: return "F-Measure";
    default: Fail; return TStr();
  }
}
开发者ID:Accio,项目名称:snap,代码行数:16,代码来源:ts.cpp

示例9: Lx

PTb TTb::LoadTxtTab(const TStr& FNm, const PTb& Tb){
  // open file
  PSIn SIn=TFIn::New(FNm);
  TILx Lx(SIn, TFSet()|iloTabSep);

  // read variable names
  Lx.GetStr();
  bool IsTupNm=(Lx.UcStr=="NAME")||(Lx.UcStr=="ID");
  if (IsTupNm){Lx.GetSym(syTab); Lx.GetStr();}
  do {
    PTbVarType VarType=PTbVarType(new TTbVarType());
    PTbVar Var=PTbVar(new TGTbVar(Lx.Str, VarType));
    Tb->AddVar(Var);
    if (Lx.GetSym(syTab, syEoln, syEof)==syTab){
      Lx.GetSym(syStr);}
  } while (Lx.Sym==syStr);

  // read tuples
  if (Lx.Sym!=syEof){
    Lx.GetSym(syStr, syEof);}
  while (Lx.Sym!=syEof){
    int TupN;
    if (IsTupNm){
      TupN=Tb->AddTup(Lx.GetSymStr());
      Lx.GetSym(syTab); Lx.GetStr();}
    else {TupN=Tb->AddTup();}
    for (int VarN=0; VarN<Tb->GetVars(); VarN++){
      if (VarN>0){Lx.GetSym(syTab); Lx.GetStr();}
      if (Lx.Str=='?'){Tb->PutVal(TupN, VarN, TTbVal(tvtUnknw));}
      else if (Lx.Str=='*'){Tb->PutVal(TupN, VarN, TTbVal(tvtUnimp));}
      else if (Lx.Str=='/'){Tb->PutVal(TupN, VarN, TTbVal(tvtUnapp));}
      else {
        double Flt;
        if (TStr(Lx.Str).IsFlt(Flt)){
          Tb->PutFlt(TupN, VarN, Flt);
        } else {
          Tb->PutDsc(TupN, VarN, Lx.Str);
        }
      }
    }
    //printf("Tups: %d\r", Tb->GetTups());
    Lx.GetSym(syEoln, syEof);
    while (Lx.Sym==syEoln){Lx.GetSym(syStr, syEoln, syEof);}
  }
  Tb->DefVarTypes();
  return Tb;
}
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:47,代码来源:tb.cpp

示例10: HtmlLx

void THtml::GetTokens(const PSIn& SIn, TStrV& TokenV) const {
	THtmlLx HtmlLx(SIn, false);
    // traverse html string symbols
	while (HtmlLx.Sym!=hsyEof){
		if (HtmlLx.Sym==hsyStr){
			TStr UcStr = HtmlLx.UcChA;
			// check if stop word
			if ((SwSet.Empty()) || (!SwSet->IsIn(UcStr))) {
				TStr TokenStr = ToUcP ? UcStr : TStr(HtmlLx.ChA);
				if (!Stemmer.Empty()) { 
					TokenStr = Stemmer->GetStem(TokenStr); }
				TokenV.Add(TokenStr.GetLc());
			}
		}
		// get next symbol
		HtmlLx.GetSym();
	}
}
开发者ID:Austindeadhead,项目名称:qminer,代码行数:18,代码来源:tokenizer.cpp

示例11: GetAddId

void TStrFeatureSpace::FromAddStr(const TStr& Serialized, TIntFltKdV& Vec, char Sep) {
	TStrV Toks;
	Serialized.SplitOnAllCh(Sep, Toks, true);
	Vec.Gen(Toks.Len());
	for (int i = 0; i < Toks.Len(); i++) {
		TStr Key, Value;
		Toks[i].SplitOnCh(Key, ':', Value);
		int FeatureId = GetAddId(Key);
		double FeatureWgt;
		if (Value.IsFlt(FeatureWgt)) {
			Vec[i].Key = FeatureId;
			Vec[i].Dat = FeatureWgt;
		} else {
			EFailR((Value + TStr(" is not a valid floating point number.")).CStr());
		}
	}
	Vec.Sort();
}
开发者ID:simp1eton,项目名称:snap-social,代码行数:18,代码来源:strftrspace.cpp

示例12: switch

TStr TLxSymStr::GetSymStr(const TLxSym& Sym){
  switch (Sym){
    case syUndef: return UndefStr;
    case syLn: return LnStr;
    case syTab: return TabStr;
    case syInt: return IntStr;
    case syFlt: return FltStr;
    case syStr: return StrStr;
    case syIdStr: return IdStrStr;
    case syQStr: return QStrStr;
    case syPeriod: return PeriodStr;
    case syDPeriod: return DPeriodStr;
    case syComma: return CommaStr;
    case syColon: return ColonStr;
    case syDColon: return DColonStr;
    case sySemicolon: return SemicolonStr;
    case syPlus: return PlusStr;
    case syMinus: return MinusStr;
    case syAsterisk: return AsteriskStr;
    case sySlash: return SlashStr;
    case syPercent: return PercentStr;
    case syExclamation: return ExclamationStr;
    case syVBar: return VBarStr;
    case syAmpersand: return AmpersandStr;
    case syQuestion: return QuestionStr;
    case syHash: return HashStr;
    case syEq: return EqStr;
    case syNEq: return NEqStr;
    case syLss: return LssStr;
    case syGtr: return GtrStr;
    case syLEq: return LEqStr;
    case syGEq: return GEqStr;
    case syLParen: return LParenStr;
    case syRParen: return RParenStr;
    case syLBracket: return LBracketStr;
    case syRBracket: return RBracketStr;
    case syLBrace: return LBraceStr;
    case syRBrace: return RBraceStr;
    case syEoln: return EolnStr;
    case syEof: return EofStr;
    default: Fail; return TStr();
  }
}
开发者ID:tadejs,项目名称:qminer-1,代码行数:43,代码来源:lx.cpp

示例13: switch

TStr TTbVal::GetValTagStr(const int& ValTag) {
    switch (ValTag) {
    case tvtUndef:
        return "<Undef>";
    case tvtUnknw:
        return "<Unknw>";
    case tvtUnimp:
        return "<Unimp>";
    case tvtUnapp:
        return "<Unapp>";
    case tvtDsc:
        return "<Dsc>";
    case tvtFlt:
        return "<Flt>";
    default:
        Fail;
        return TStr();
    }
}
开发者ID:kevinking,项目名称:snap,代码行数:19,代码来源:tbval.cpp

示例14: ChTyV

TLxChDef::TLxChDef(const TLxChDefTy& ChDefTy):
  ChTyV(TCh::Vals), UcChV(TCh::Vals){

  if (ChDefTy==lcdtUsAscii){
    // Character-Types
    ChTyV.PutAll(TInt(lctSpace));
    SetChTy(lctNum, "0123456789");
    SetChTy(lctAlpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    SetChTy(lctAlpha, "abcdefghijklmnopqrstuvwxyz");
    SetChTy(lctAlpha, "@_");
    SetChTy(lctSSym, "\"'.,:;+-*/%!#|&<=>?()[]{}");
    SetChTy(lctTerm, TStr(TCh::CrCh));
    SetChTy(lctTerm, TStr(TCh::LfCh));
    SetChTy(lctTerm, TStr(TCh::EofCh));

    // Upper-Case
    for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
    SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("Dd"); SetUcCh("Ee");
    SetUcCh("Ff"); SetUcCh("Gg"); SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj");
    SetUcCh("Kk"); SetUcCh("Ll"); SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo");
    SetUcCh("Pp"); SetUcCh("Qq"); SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("Tt");
    SetUcCh("Uu"); SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy");
    SetUcCh("Zz");
  } else
  if (ChDefTy==lcdtYuAscii){
    // Character-Types
    ChTyV.PutAll(TInt(lctSpace));
    SetChTy(lctNum, "0123456789");
    SetChTy(lctAlpha, "ABC^]D\\EFGHIJKLMNOPQRS[[email protected]");
    SetChTy(lctAlpha, "abc~}d|efghijklmnopqrs{tuvwxyz`");
    SetChTy(lctAlpha, "_");
    SetChTy(lctSSym, "\".,:;+-*/%!#&<=>?()");
    SetChTy(lctTerm, TStr(TCh::CrCh));
    SetChTy(lctTerm, TStr(TCh::LfCh));
    SetChTy(lctTerm, TStr(TCh::EofCh));

    // Upper-Case
    for (int Ch=TCh::Mn; Ch<=TCh::Mx; Ch++){UcChV[Ch-TCh::Mn]=TCh(char(Ch));}
    SetUcCh("Aa"); SetUcCh("Bb"); SetUcCh("Cc"); SetUcCh("^~"); SetUcCh("]}");
    SetUcCh("Dd"); SetUcCh("\\|"); SetUcCh("Ee"); SetUcCh("Ff"); SetUcCh("Gg");
    SetUcCh("Hh"); SetUcCh("Ii"); SetUcCh("Jj"); SetUcCh("Kk"); SetUcCh("Ll");
    SetUcCh("Mm"); SetUcCh("Nn"); SetUcCh("Oo"); SetUcCh("Pp"); SetUcCh("Qq");
    SetUcCh("Rr"); SetUcCh("Ss"); SetUcCh("[{"); SetUcCh("Tt"); SetUcCh("Uu");
    SetUcCh("Vv"); SetUcCh("Ww"); SetUcCh("Xx"); SetUcCh("Yy"); SetUcCh("Zz");
    SetUcCh("@`");
  } else {
    Fail;
  }
}
开发者ID:tadejs,项目名称:qminer-1,代码行数:49,代码来源:lx.cpp

示例15: SendToStatusAndTrm

void TWebTxtBs::FetchStart(
 const TStr& Nm, const TStr& FPath,
 const TStr& WebFilterFNm, const bool& IndexTxtBsP){
  if (IsTxtBsActive()){
    if (IsFetchActive()){
      SendToStatusAndTrm("Web-Fetch already active.");
    } else {
      PWebFilter WebFilter=TWebFilter::LoadTxt(WebFilterFNm);
      if (WebFilter.Empty()){
        SendToStatusAndTrm(TStr("Web-Filter '")+WebFilterFNm+"' does not exist.");
      } else {
        WebBsFetch=PWebBsFetch(new
         TWebBsFetch(Nm, FPath, faCreate, this, WebFilter, IndexTxtBsP));
        WebBsFetch->GoFetch();
      }
    }
  } else {
    SendToStatusAndTrm("Web-Base not active.");
  }
}
开发者ID:mkarlovc,项目名称:gcentralization,代码行数:20,代码来源:webtxtbs.cpp


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