Poster of Linux kernelThe best gift for a Linux geek
GetPot::variable

GetPot::variable

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

GetPot::variable -  

SYNOPSIS


 

Public Member Functions


variable ()

variable (const variable &)

variable (const char *Name, const char *Value)

~variable ()

variable & operator= (const variable &Other)

void take (const char *Value)

const std::string * get_element (unsigned Idx) const
 

Public Attributes


std::string name

std::vector< std::string > value

std::string original
 

Detailed Description

Definition at line 183 of file getpot.h.  

Constructor & Destructor Documentation

 

GetPot::variable::variable () [inline]

Definition at line 2066 of file getpot.h.

{}
 

GetPot::variable::variable (const variable &Other) [inline]

Definition at line 2072 of file getpot.h.

References GetPot::operator=().

{ 
#ifdef WIN32
  operator=(Other); 
#else
  GetPot::variable::operator=(Other); 
#endif
}
 

GetPot::variable::variable (const char *Name, const char *Value) [inline]

Definition at line 2084 of file getpot.h.

References take().

: name(Name) 
{ 
  // make a copy of the 'Value'
  take(Value);
}
 

GetPot::variable::~variable () [inline]

Definition at line 2123 of file getpot.h.

{}
 

Member Function Documentation

 

const std::string * GetPot::variable::get_element (unsignedIdx) const [inline]

Definition at line 2094 of file getpot.h.

Referenced by GetPot::operator()().

{ if( Idx >= value.size() ) return 0; else return &(value[Idx]); }
 

GetPot::variable & GetPot::variable::operator= (const variable &Other) [inline]

Definition at line 2129 of file getpot.h.

References name, Quality::name(), original, and value.

{
  if( &Other != this) {
    name     = Other.name;
    value    = Other.value;
    original = Other.original;
  }
  return *this;
}
 

void GetPot::variable::take (const char *Value) [inline]

Definition at line 2100 of file getpot.h.

Referenced by variable().

{ 
  original = std::string(Value);

  // separate string by white space delimiters using 'strtok'
  // thread safe usage of strtok (no static members)
  char* spt = 0; 
  // make a copy of the 'Value'
  char* copy = new char[std::strlen(Value)+1];
  std::strcpy(copy, Value);
  char* follow_token = strtok_r(copy, ' 	, &spt);
  if( value.size() != 0 ) value.erase(value.begin(), value.end());
  while(follow_token != 0) {
    value.push_back(std::string(follow_token));
    follow_token = strtok_r(NULL, ' 	, &spt);
  }

  delete [] copy;
}
 

Member Data Documentation

 

std::string GetPot::variable::name

Definition at line 202 of file getpot.h.

Referenced by GetPot::__DBE_expand(), GetPot::__DBE_get_variable(), and operator=().  

std::string GetPot::variable::original

Definition at line 204 of file getpot.h.

Referenced by GetPot::__DBE_expand(), GetPot::__DBE_get_variable(), GetPot::operator()(), and operator=().  

std::vector<std::string> GetPot::variable::value

Definition at line 203 of file getpot.h.

Referenced by operator=(), and GetPot::vector_variable_size().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Public Attributes
Detailed Description
Constructor & Destructor Documentation
GetPot::variable::variable () [inline]
GetPot::variable::variable (const variable &Other) [inline]
GetPot::variable::variable (const char *Name, const char *Value) [inline]
GetPot::variable::~variable () [inline]
Member Function Documentation
const std::string * GetPot::variable::get_element (unsignedIdx) const [inline]
GetPot::variable & GetPot::variable::operator= (const variable &Other) [inline]
void GetPot::variable::take (const char *Value) [inline]
Member Data Documentation
std::string GetPot::variable::name
std::string GetPot::variable::original
std::vector<std::string> GetPot::variable::value
Author

This document was created by man2html, using the manual pages.
Time: 21:46:45 GMT, April 16, 2011