libmesh解析
本工作只是尝试解析原libmesh的代码,供学习使用
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 
Public 成员函数 | Public 属性 | 所有成员列表
GETPOT_NAMESPACE::GetPot::variable结构体 参考

Variable to be specified on the command line or in input files. 更多...

Public 成员函数

 variable ()
 constructors, destructors, assignment operator 更多...
 
 variable (const variable &)
 
 variable (const char *Name, const char *Value, const char *FieldSeparator)
 
 ~variable ()
 
variableoperator= (const variable &Other)
 
void take (const char *Value, const char *FieldSeparator)
 
const std::string * get_element (unsigned Idx) const
 get a specific element in the string vector (return 0 if not present) 更多...
 

Public 属性

std::string name
 data members 更多...
 
STRING_VECTOR value
 
std::string original
 

详细描述

Variable to be specified on the command line or in input files.

(i.e. of the form var='12 312 341')

在文件 getpot.h479 行定义.

构造及析构函数说明

GETPOT_NAMESPACE::GetPot::variable::variable ( )
inline

constructors, destructors, assignment operator

在文件 getpot.h3914 行定义.

3915  : name(),
3916  value(),
3917  original()
3918 {}
std::string name
data members
Definition: getpot.h:501
GETPOT_NAMESPACE::GetPot::variable::variable ( const variable Other)
inline

在文件 getpot.h3923 行定义.

参考 GETPOT_NAMESPACE::GetPot::operator=() , 以及 operator=().

3924 {
3925 #ifdef WIN32
3926  operator=(Other);
3927 #else
3929 #endif
3930 }
variable & operator=(const variable &Other)
Definition: getpot.h:4016
GETPOT_NAMESPACE::GetPot::variable::variable ( const char *  Name,
const char *  Value,
const char *  FieldSeparator 
)
inline

在文件 getpot.h3935 行定义.

参考 take().

3936  : name(Name)
3937 {
3938  // make a copy of the 'Value'
3939  take(Value, FieldSeparator);
3940 }
std::string name
data members
Definition: getpot.h:501
void take(const char *Value, const char *FieldSeparator)
Definition: getpot.h:3956
GETPOT_NAMESPACE::GetPot::variable::~variable ( )
inline

在文件 getpot.h4010 行定义.

4011 {}

成员函数说明

const std::string * GETPOT_NAMESPACE::GetPot::variable::get_element ( unsigned  Idx) const
inline

get a specific element in the string vector (return 0 if not present)

在文件 getpot.h3945 行定义.

参考自 GETPOT_NAMESPACE::GetPot::get_value_no_default() , 以及 GETPOT_NAMESPACE::GetPot::operator()().

3946 {
3947  if (Idx >= value.size())
3948  return 0;
3949  else
3950  return &(value[Idx]);
3951 }
GetPot::variable & GETPOT_NAMESPACE::GetPot::variable::operator= ( const variable Other)
inline

在文件 getpot.h4016 行定义.

参考 name, original , 以及 value.

参考自 variable().

4017 {
4018  if (&Other != this)
4019  {
4020  name = Other.name;
4021  value = Other.value;
4022  original = Other.original;
4023  }
4024  return *this;
4025 }
std::string name
data members
Definition: getpot.h:501
void GETPOT_NAMESPACE::GetPot::variable::take ( const char *  Value,
const char *  FieldSeparator 
)
inline

在文件 getpot.h3956 行定义.

参考自 variable().

3957 {
3958  original = std::string(Value); // string member var
3959  value.clear(); // vector<string> member var
3960 
3961  /*
3962  // separate string by white space delimiters using 'strtok'
3963  // thread safe usage of strtok (no static members)
3964  char* spt = 0;
3965  // make a copy of the 'Value'
3966  char* copy = new char[strlen(Value)+1];
3967  strcpy(copy, Value);
3968  char* follow_token = strtok_r(copy, FieldSeparator, &spt);
3969  while (follow_token != 0)
3970  {
3971  value.push_back(std::string(follow_token));
3972  follow_token = strtok_r(NULL, FieldSeparator, &spt);
3973  }
3974 
3975  delete [] copy;
3976  */
3977 
3978  // Don't use strtok, instead tokenize the input char "Value" using std::string operations so
3979  // that the results end up in the local "value" member
3980 
3981  // Construct std::string objects from the input char*s. I think the only
3982  // FieldSeparator recognized by GetPot is whitespace?
3983  std::string Value_str = std::string(Value);
3984  std::string delimiters = std::string(FieldSeparator);
3985 
3986  // Skip delimiters at beginning.
3987  std::string::size_type lastPos = Value_str.find_first_not_of(delimiters, 0);
3988 
3989  // Find first "non-delimiter".
3990  std::string::size_type pos = Value_str.find_first_of(delimiters, lastPos);
3991 
3992  // Loop over the input string until all the tokens have been pushed back
3993  // into the local "value" member.
3994  while (std::string::npos != pos || std::string::npos != lastPos)
3995  {
3996  // Found a token, add it to the vector.
3997  value.push_back(Value_str.substr(lastPos, pos - lastPos));
3998 
3999  // Skip delimiters. Note the "not_of"
4000  lastPos = Value_str.find_first_not_of(delimiters, pos);
4001 
4002  // Find next "non-delimiter"
4003  pos = Value_str.find_first_of(delimiters, lastPos);
4004  }
4005 
4006  // We're done, all the tokens should now be in the vector<string>
4007 }

类成员变量说明

std::string GETPOT_NAMESPACE::GetPot::variable::name

data members

在文件 getpot.h501 行定义.

参考自 GETPOT_NAMESPACE::GetPot::_DBE_expand() , 以及 operator=().

std::string GETPOT_NAMESPACE::GetPot::variable::original
STRING_VECTOR GETPOT_NAMESPACE::GetPot::variable::value

在文件 getpot.h502 行定义.

参考自 operator=() , 以及 GETPOT_NAMESPACE::GetPot::vector_variable_size().


该结构体的文档由以下文件生成: