SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TExpHelp Class Reference

#include <exp.h>

Collaboration diagram for TExpHelp:

List of all members.

Public Member Functions

 TExpHelp ()
 ~TExpHelp ()
 TExpHelp (TSIn &SIn)
void Save (TSOut &SOut) const
TExpHelpoperator= (const TExpHelp &)
bool operator== (const TExpHelp &) const
void AddObj (const PExpHelpObj &Obj)
void GetCatNmV (TStrV &CatNmV) const
void GetObjHdNmV (const TStr &CatNm, TStrV &ObjHdNmV) const
PExpHelpObj GetObj (const TStr &ObjNm) const

Static Public Member Functions

static PExpHelp New ()
static PExpHelp Load (TSIn &SIn)
static PExpHelp LoadXml (const PSIn &SIn)
static PExpHelp LoadXml (const TStr &FNm)

Private Attributes

TCRef CRef
TExpHelpObjV ObjV

Friends

class TPt< TExpHelp >

Detailed Description

Definition at line 351 of file exp.h.


Constructor & Destructor Documentation

TExpHelp::TExpHelp ( ) [inline]

Definition at line 355 of file exp.h.

: ObjV(){}
TExpHelp::~TExpHelp ( ) [inline]

Definition at line 357 of file exp.h.

{}
TExpHelp::TExpHelp ( TSIn SIn) [inline]

Definition at line 358 of file exp.h.

: ObjV(SIn){}

Member Function Documentation

void TExpHelp::AddObj ( const PExpHelpObj Obj) [inline]

Definition at line 369 of file exp.h.

{ObjV.Add(Obj);}
void TExpHelp::GetCatNmV ( TStrV CatNmV) const

Definition at line 1126 of file exp.cpp.

References TVec< TVal >::AddUnique(), TVec< TVal >::Clr(), TVec< TVal >::Ins(), TVec< TVal >::Len(), and ObjV.

                                            {
  CatNmV.Clr();
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    TStr CatNm=ObjV[ObjN]->GetCatNm();
    CatNmV.AddUnique(CatNm);
  }
  CatNmV.Ins(0, "All");
}

Here is the call graph for this function:

PExpHelpObj TExpHelp::GetObj ( const TStr ObjNm) const

Definition at line 1146 of file exp.cpp.

References TStr::GetUc(), TVec< TVal >::Len(), and ObjV.

                                                    {
  PExpHelpObj Obj;
  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
    if (ObjV[ObjN]->GetHdItem()->GetNm().GetUc()==ObjNm.GetUc()){
      return ObjV[ObjN];}
  }
  return NULL;
}

Here is the call graph for this function:

void TExpHelp::GetObjHdNmV ( const TStr CatNm,
TStrV ObjHdNmV 
) const

Definition at line 1135 of file exp.cpp.

References TVec< TVal >::AddUnique(), TVec< TVal >::Clr(), TStr::Empty(), TVec< TVal >::Len(), ObjV, and TVec< TVal >::Sort().

                                                                   {
  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();
}

Here is the call graph for this function:

static PExpHelp TExpHelp::Load ( TSIn SIn) [inline, static]

Definition at line 359 of file exp.h.

{return PExpHelp(new TExpHelp(SIn));}
PExpHelp TExpHelp::LoadXml ( const PSIn SIn) [static]

Definition at line 1084 of file exp.cpp.

References TVec< TVal >::Add(), TExpHelpObj::GetObjTypeFromStr(), TXmlTok::GetTagTok(), TXmlTok::GetTagTokV(), TXmlTok::GetTokStr(), TVec< TVal >::Len(), TXmlDoc::LoadTxt(), and New().

                                         {
  // create expression help
  PExpHelp ExpHelp=TExpHelp::New();
  // load xml with expression help
  PXmlDoc Doc=TXmlDoc::LoadTxt(SIn);
  // retrieve objects
  TXmlTokV ObjTokV; Doc->GetTagTokV("ExpHelp|Obj", ObjTokV);
  for (int ObjTokN=0; ObjTokN<ObjTokV.Len(); ObjTokN++){
    PXmlTok ObjTok=ObjTokV[ObjTokN];
    // type
    TStr TypeStr=ObjTok->GetTagTok("Type")->GetTokStr(false);
    // category
    TStr CatNm=ObjTok->GetTagTok("Cat")->GetTokStr(false);
    // header
    TStr HdNm=ObjTok->GetTagTok("Head|Name")->GetTokStr(false);
    TStr HdTypeStr=ObjTok->GetTagTok("Head|Type")->GetTokStr(false);
    TStr HdDescStr=ObjTok->GetTagTok("Head|Desc")->GetTokStr(false);
    PExpHelpItem HdItem=
     TExpHelpItem::New(HdNm, HdTypeStr, HdDescStr, "");
    // arguments
    TXmlTokV ArgTokV; ObjTok->GetTagTokV("Args|Arg", ArgTokV);
    TExpHelpItemV ArgItemV;
    for (int ArgTokN=0; ArgTokN<ArgTokV.Len(); ArgTokN++){
      PXmlTok ArgTok=ArgTokV[ArgTokN];
      // argument
      TStr ArgNm=ArgTok->GetTagTok("Name")->GetTokStr(false);
      TStr ArgTypeStr=ArgTok->GetTagTok("Type")->GetTokStr(false);
      TStr ArgDescStr=ArgTok->GetTagTok("Desc")->GetTokStr(false);
      TStr ArgDfValStr=ArgTok->GetTagTok("Default")->GetTokStr(false);
      PExpHelpItem ArgItem=
       TExpHelpItem::New(ArgNm, ArgTypeStr, ArgDescStr, ArgDfValStr);
      ArgItemV.Add(ArgItem);
    }
    // create & add object
    TExpHelpObjType Type=TExpHelpObj::GetObjTypeFromStr(TypeStr);
    PExpHelpObj Obj=TExpHelpObj::New(Type, CatNm, HdItem, ArgItemV);
    ExpHelp->AddObj(Obj);
  }
  // return result
  return ExpHelp;
}

Here is the call graph for this function:

static PExpHelp TExpHelp::LoadXml ( const TStr FNm) [inline, static]

Definition at line 366 of file exp.h.

References TFIn::New().

                                          {
    PSIn SIn=TFIn::New(FNm); return LoadXml(SIn);}

Here is the call graph for this function:

static PExpHelp TExpHelp::New ( ) [inline, static]

Definition at line 356 of file exp.h.

Referenced by LoadXml().

{return PExpHelp(new TExpHelp());}

Here is the caller graph for this function:

TExpHelp& TExpHelp::operator= ( const TExpHelp ) [inline]

Definition at line 362 of file exp.h.

References Fail.

{Fail; return *this;}
bool TExpHelp::operator== ( const TExpHelp ) const [inline]

Definition at line 363 of file exp.h.

References Fail.

{Fail; return false;}
void TExpHelp::Save ( TSOut SOut) const [inline]

Definition at line 360 of file exp.h.

{ObjV.Save(SOut);}

Friends And Related Function Documentation

friend class TPt< TExpHelp > [friend]

Definition at line 351 of file exp.h.


Member Data Documentation

TCRef TExpHelp::CRef [private]

Definition at line 351 of file exp.h.

Definition at line 353 of file exp.h.

Referenced by GetCatNmV(), GetObj(), and GetObjHdNmV().


The documentation for this class was generated from the following files: