Gaudi Framework, version v23r4

Home   Generated: Mon Sep 17 2012
Public Member Functions | Public Attributes | Private Member Functions

EnvConfig::Variable::Scalar Class Reference

List of all members.

Public Member Functions

def __init__
def name
def set
def value
def remove_regexp
def remove
def append
def prepend
def repl
def resolveReferences
def search
def __str__

Public Attributes

 report
 name
 val
 local

Private Member Functions

def _changeSlashes

Detailed Description

Class for manipulating with environment scalars.

Definition at line 225 of file Variable.py.


Constructor & Destructor Documentation

def EnvConfig::Variable::Scalar::__init__ (   self,
  name,
  local = False,
  report = None 
)

Definition at line 228 of file Variable.py.

00229                                                         :
00230         self.report = report
00231         self.name = name
00232         self.val = ''
00233 
00234         self.local = local


Member Function Documentation

def EnvConfig::Variable::Scalar::__str__ (   self )

Definition at line 307 of file Variable.py.

00308                      :
00309         return self.val

def EnvConfig::Variable::Scalar::_changeSlashes (   self ) [private]
Changes slashes depending on operating system.

Definition at line 297 of file Variable.py.

00298                             :
00299         '''Changes slashes depending on operating system.'''
00300         if self.val == '[':
00301             if platform.system() != 'Linux':
00302                 self.val = self.val[1:]
00303             else:
00304                 self.val = self.val[3:]
00305         self.val = os.path.normpath(self.val)
00306 

def EnvConfig::Variable::Scalar::append (   self,
  value,
  separator = ':',
  environment = {},
  warningOn = True 
)
Adds value(s) at the end of the scalar.

Definition at line 262 of file Variable.py.

00262                                         :', environment={}, warningOn=True):
00263         '''Adds value(s) at the end of the scalar.'''
00264         value = self.resolveReferences(value, environment)
00265         self.val = self.val + value
00266         self._changeSlashes()
00267 
00268 
Returns the name of the scalar.

Definition at line 235 of file Variable.py.

00236                   :
00237         '''Returns the name of the scalar.'''
00238         return self.name

def EnvConfig::Variable::Scalar::prepend (   self,
  value,
  action = 'cancel',
  separator = ':',
  environment = {} 
)
Adds value(s) at the beginning of the scalar.

Definition at line 269 of file Variable.py.

00269                                                          :', environment={}):
00270         '''Adds value(s) at the beginning of the scalar.'''
00271         value = self.resolveReferences(value, environment)
00272         self.val = value + self.val
00273         self._changeSlashes()
00274 
00275 
def EnvConfig::Variable::Scalar::remove (   self,
  value,
  separator = ':',
  regexp = True 
)
Removes value(s) from the scalar. If value is not found, removal is canceled.

Definition at line 256 of file Variable.py.

00256                                          :', regexp=True):
00257         '''Removes value(s) from the scalar. If value is not found, removal is canceled.'''
00258         value = self.search(value)
00259         for val in value:
00260             self.val = self.val.replace(val,'')
00261 
def EnvConfig::Variable::Scalar::remove_regexp (   self,
  value,
  separator = ':' 
)

Definition at line 253 of file Variable.py.

00253                                               :'):
00254         self.remove(value, separator, True)
00255 
def EnvConfig::Variable::Scalar::repl (   self,
  s,
  d 
)

Definition at line 276 of file Variable.py.

00277                         :
00278         v = re.compile(r"\$([A-Za-z_][A-Za-z0-9_]*)|\$\(([A-Za-z_][A-Za-z0-9_]*)\)|\$\{([A-Za-z_][A-Za-z0-9_]*)\}")
00279         m = v.search(s)
00280         if m:
00281             s = s[:m.start()] + str(d[filter(None,m.groups())[0]]) + s[m.end():]
00282             return self.repl(s,d)
00283         else:
00284             return s
00285 

def EnvConfig::Variable::Scalar::resolveReferences (   self,
  value,
  environment 
)
Resolve references inside the scalar.

Definition at line 286 of file Variable.py.

00287                                                    :
00288         '''Resolve references inside the scalar.'''
00289 
00290         value = self.repl(value, environment)
00291         return value

def EnvConfig::Variable::Scalar::search (   self,
  expr 
)
Searches in scalar`s values for a match

Definition at line 292 of file Variable.py.

00293                           :
00294         '''Searches in scalar`s values for a match'''
00295         return re.findall(expr,self.val)
00296 

def EnvConfig::Variable::Scalar::set (   self,
  value,
  separator = ':',
  environment = {},
  resolve = True 
)
Sets the value of the scalar. Any previous value is overwritten.

Definition at line 239 of file Variable.py.

00239                                       :', environment={}, resolve = True):
00240         '''Sets the value of the scalar. Any previous value is overwritten.'''
00241         if resolve:
00242             value = self.resolveReferences(value, environment)
00243         self.val = value
00244         self._changeSlashes()
00245         if self.val == '.':
00246             self.val = ""
00247 
00248 
def EnvConfig::Variable::Scalar::value (   self,
  asString = False,
  separator = ':' 
)
Returns values of the scalar.

Definition at line 249 of file Variable.py.

00249                                                    :'):
00250         '''Returns values of the scalar.'''
00251         return self.val
00252 

Member Data Documentation

Definition at line 228 of file Variable.py.

Definition at line 228 of file Variable.py.

Definition at line 228 of file Variable.py.

Definition at line 228 of file Variable.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Mon Sep 17 2012 13:49:53 for Gaudi Framework, version v23r4 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004