Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Variable Class Reference

#include <cmt_fragment.h>

Collaboration diagram for Variable:

Collaboration graph
[legend]
List of all members.

Public Types

typedef cmt_vector<Variable> VariableVector

Public Methods

 Variable ()
 Variable (const cmt_string& n)
const cmt_stringmacro_braces () const
const cmt_stringmacro_pars () const
void set (const cmt_string& new_name, const cmt_string& new_value = "")
Variable& operator= (const Variable& other)
Variable& operator= (const cmt_string& v)
void operator+= (const cmt_string& v)
cmt_string operator+ (const cmt_string& v) const
 operator const cmt_string & () const
bool operator== (const cmt_string& v) const
bool operator!= (const cmt_string& v) const

Public Attributes

cmt_string name
cmt_string value

Static Public Methods

Variable* find (VariableVector& vector, const cmt_string& name)

Private Attributes

cmt_string m_macro_braces
cmt_string m_macro_pars

Member Typedef Documentation

typedef cmt_vector<Variable> Variable::VariableVector
 

Definition at line 13 of file cmt_fragment.h.


Constructor & Destructor Documentation

Variable::Variable ( )
 

Definition at line 34 of file cmt_fragment.cxx.

00035 {
00036 }

Variable::Variable ( const cmt_string & n )
 

Definition at line 39 of file cmt_fragment.cxx.

00039                                        : name (n)
00040 {
00041   m_macro_braces = "${";
00042   m_macro_braces += name;
00043   m_macro_braces += "}";
00044 
00045   m_macro_pars = "$(";
00046   m_macro_pars += name;
00047   m_macro_pars += ")";
00048 }


Member Function Documentation

Variable * Variable::find ( VariableVector & vector,
const cmt_string & name ) [static]
 

Definition at line 20 of file cmt_fragment.cxx.

Referenced by CmtModel::expand(), and constituents_action_iterator::set().

00022 {
00023   for (int i = 0; i < vector.size (); i++)
00024     {
00025       Variable& v = vector[i];
00026 
00027       if (v.name == name) return (&v);
00028     }
00029 
00030   return (0);
00031 }

const cmt_string & Variable::macro_braces ( ) const
 

Definition at line 51 of file cmt_fragment.cxx.

Referenced by Fragment::copy(), and Fragment::wincopy().

00052 {
00053   return (m_macro_braces);
00054 }

const cmt_string & Variable::macro_pars ( ) const
 

Definition at line 57 of file cmt_fragment.cxx.

Referenced by Fragment::copy(), and Fragment::wincopy().

00058 {
00059   return (m_macro_pars);
00060 }

Variable::operator const cmt_string & ( ) const
 

Definition at line 105 of file cmt_fragment.cxx.

00106 {
00107   return (value);
00108 }

bool Variable::operator!= ( const cmt_string & v ) const
 

Definition at line 117 of file cmt_fragment.cxx.

00118 {
00119   return ((value != v));
00120 }

cmt_string Variable::operator+ ( const cmt_string & v ) const
 

Definition at line 99 of file cmt_fragment.cxx.

00100 {
00101   return (value + v);
00102 }

void Variable::operator+= ( const cmt_string & v )
 

Definition at line 93 of file cmt_fragment.cxx.

00094 {
00095   value += v;
00096 }

Variable & Variable::operator= ( const cmt_string & v )
 

Definition at line 86 of file cmt_fragment.cxx.

00087 {
00088   value = v;
00089   return (*this);
00090 }

Variable & Variable::operator= ( const Variable & other )
 

Definition at line 79 of file cmt_fragment.cxx.

00080 {
00081   value = other.value;
00082   return (*this);
00083 }

bool Variable::operator== ( const cmt_string & v ) const
 

Definition at line 111 of file cmt_fragment.cxx.

00112 {
00113   return ((value == v));
00114 }

void Variable::set ( const cmt_string & new_name,
const cmt_string & new_value = "" )
 

Definition at line 63 of file cmt_fragment.cxx.

Referenced by CmtModel::expand(), and constituents_action_iterator::set().

00065 {
00066   name = new_name;
00067   value = new_value;
00068 
00069   m_macro_braces = "${";
00070   m_macro_braces += name;
00071   m_macro_braces += "}";
00072 
00073   m_macro_pars = "$(";
00074   m_macro_pars += name;
00075   m_macro_pars += ")";
00076 }


Member Data Documentation

cmt_string Variable::m_macro_braces [private]
 

Definition at line 40 of file cmt_fragment.h.

cmt_string Variable::m_macro_pars [private]
 

Definition at line 41 of file cmt_fragment.h.

cmt_string Variable::name
 

Definition at line 36 of file cmt_fragment.h.

cmt_string Variable::value
 

Definition at line 37 of file cmt_fragment.h.


The documentation for this class was generated from the following files:
Generated at Thu May 16 16:28:02 2002 for CMT by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000