2005/5/9

     
 

class Props

artefaktur
Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::cfgscript::Props Class Reference

#include <Props.h>

Inheritance diagram for acdk::cfgscript::Props:

acdk::lang::Object acdk::lang::Cloneable acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

Generic Properties holding DmiObject's.

Can be used as more powerfull replacement for acdk::util::Properties the eval functions are tightly connected with the  CfgScript language.


Public Member Functions

 Props (IN(RString) name, short flags=PropsNoFlags, IN(RProps) parent=Nil, bool private_props=true)
 Props (short flags=PropsNoFlags, IN(RProps) parent=Nil, bool private_props=true)
 Props (IN(acdk::lang::dmi::RDmiNamedArgArray) namedArgs, short flags=PropsNoFlags)
acdk::lang::Object clone (acdk::lang::sys::Allocator *alloc)
 this clone only clones the underlying HashMap.

acdk::lang::Object clone ()
RString toString ()
 return a string representation of this object Object::toString() return getName() by default

void setName (IN(RString) name)
RString getName ()
 returns the ClassName for this object by default

void setSingleThreaded (bool singleThreaded)
bool getSingleThreaded ()
void lock ()
 lock the object instance.

void unlock ()
 unlock the object instance Note: Will be overwritten by acdk::io::Reader and acdk::io::Writer Note: if Unsynchronized or isStack is set, this call will have no effect

short getDefaultFlags ()
 a combination of PropsFlags

void setDefaultFlags (short flags)
 a combination of PropsFlags

short getCastFlags ()
 a combination of acdk::lang::dmi::ScriptVarCastFlags

void setCastFlags (short castFlags)
 a combination of acdk::lang::dmi::ScriptVarCastFlags

int size (short flags=PropsNoFlags)
RProps getParentProps ()
RPropsArray getParentsProps ()
void addParentProps (IN(RProps) nparent)
void removeParentProps (IN(RProps) nparent)
bool hasParentProps (IN(RProps) nparent)
 return true if this or a parent or parent of parent has this props reference

RStringArray getKeys (short flags=PropsNoFlags)
bool hasValue (IN(RString) key, short flags=PropsNoFlags)
RDmiObject get (IN(RString) name, short flags=PropsNoFlags)
void set (IN(RString) name, IN(RDmiObject) value, short flags=PropsNoFlags)
 set a new value

void unset (IN(RString) name, short flags=PropsNoFlags)
 removes a key from heap

void create (IN(RString) name, IN(RDmiObject) val)
 create a new variable
Exceptions:
ScriptException if variable with same name already is defined in this property


void create (IN(RString) name, const::acdk::lang::dmi::ClazzInfo *ci)
void reset ()
 reset this props

acdk::util::RIterator keys ()
 return the iterator of this scope keys

void assign (IN(RString) name, IN(RDmiObject) val, short flags=PropsNoFlags)
 Assigns value to given name.

RHashMap findOwnerHeap (IN(RString) key)
 return the container, which owns this key.

RString getStringVal (IN(RString) name, short flags=PropsNoFlags)
RString getEvaluatedStringVal (IN(RString) name, short flags=PropsNoFlags)
 also CfgEval* flags will be needed

void setStringVal (IN(RString) key, IN(RString) value, short flags=PropsNoFlags)
void setObjectVal (IN(RString) key, IN(acdk::lang::Object) value, short flags=PropsNoFlags)
acdk::lang::Object getObjectVal (IN(RString) key, short flags=PropsNoFlags)
void setQuotedStringVal (IN(RString) key, IN(RString) value, short flags=PropsNoFlags)
 equal to setStringArrayVal but if value contains spaces CMDLINE_QUOTE_CHAR will be used to quote value

RString getQuotedStringVal (IN(RString) key, short flags=PropsNoFlags)
RString getUnquotedStringVal (IN(RString) key, short flags=PropsNoFlags)
 equal to getQuoteStringVal, but in case argument is quoted removes quotes before return value

void appendStringVal (IN(RString) key, IN(RString) value, IN(RString) joiner, short flags=PropsNoFlags)
void setStringArrayVal (IN(RString) key, IN(RStringArray) value, short flags=PropsNoFlags)
void appendStringArrayVal (IN(RString) key, IN(RString) value, short flags=PropsNoFlags)
RStringArray getStringArrayVal (IN(RString) key, short flags=PropsNoFlags)
 return StringArray returns a empty StringArray if not found

RStringArray getAllStringArrayVal (IN(RString) key, short flags=PropsNoFlags)
 collects in this an parent props all StringArrayVals in a single StringArrayVals

bool containsInStringArrayVal (IN(RString) key, IN(RString) value, short flags=PropsNoFlags)
void appendObjectList (IN(RString) key, IN(acdk::lang::Object) val, short flags=PropsNoFlags)
bool getBoolVal (IN(RString) key, short flags=PropsNoFlags)
void setBoolVal (IN(RString) key, bool val, short flags=PropsNoFlags)
int getIntVal (IN(RString) key, short flags=PropsNoFlags)
void setIntVal (IN(RString) key, int val, short flags=PropsNoFlags)
double getDoubleVal (IN(RString) key, short flags=PropsNoFlags)
void setDoubleVal (IN(RString) key, double val, short flags=PropsNoFlags)
RProps getProps (IN(RString) name, short flags=PropsNoFlags)
void setProps (IN(RString) name, IN(RProps) props, short flags=PropsNoFlags)
void merge (IN(RProps) other, short flags=PropsNoFlags)
 merge other into this props.

RString eval (IN(RString) str, short flags=PropsNoFlags)
 evaluates embeeded script parrs

void execScript (IN(RString) str, IN(RString) filename=, short flags=PropsParentRead|PropsParentWrite)
 execute a script

RString evalShellExecute (IN(RString) str, short flags)
 eval embedded backtick commands like `ls`

bool importNameSpace (IN(RString) prefix)
 if prefix is PREF imports / overwites KEY = PREF_KEY

RStringArray getAllStringVals (IN(RString) key, short flags=PropsNoFlags)
 returns all different vals of given key in this and parents

void dump (int dumpFlags=DumpWithParent,::acdk::util::RTreeSet keys=Nil, IN(RString) ident=)
 dumps to System::out

RString asCfgScriptLiteral (IN(RString) keyName, IN(RString) indent=, short flags=PropsNoFlags)
 this only works for basic types, Strings, Props and Arrays.

RString getAcdkHome (bool throwIfNotFound=true)
 find ACDKHOME or ACDK_HOME in props or System::properties.

RString getAcdkToolsHome (bool throwIfNotFound=true)
const acdk::lang::dmi::ClazzMethodInfostandardDispatch (IN(acdk::lang::RString) fname, acdk::lang::dmi::ScriptVar &ret, acdk::lang::dmi::ScriptVarArray &args, acdk::lang::dmi::DmiClient &dc, IN(::acdk::lang::RStringArray) namedArgs, int flags, const acdk::lang::dmi::ClazzInfo *clazzinfo, const acdk::lang::dmi::ClazzMethodInfo *methinf)
void addListener (IN(RPropsChangeListener) listener)
void removeListener (IN(RPropsChangeListener) listener)

Static Public Member Functions

RStringArray makeStringArray (IN(RString) s1=Nil, IN(RString) s2=Nil, IN(RString) s3=Nil, IN(RString) s4=Nil, IN(RString) s5=Nil, IN(RString) s6=Nil, IN(RString) s7=Nil, IN(RString) s8=Nil)
 helper to create a string array


Private Member Functions

void _init ()
bool _importNameSpace (IN(RString) prefix, IN(RProps) props)
void _getKeys (IN(RStringArray) sa)
RDmiObject _get (IN(RString) name, short flags)
 unsynchronized version of get

void _set (IN(RString) name, IN(RDmiObject) val, short flags, bool notify=true)
 unsynchronized version of set

bool _readParent (short flags)
bool _writeParent (short flags)
bool _warnRead (short flags)
bool _warnWrite (short flags)
void _getKeys (INOUT(::acdk::util::TreeSet) keys, bool withParents=true)
void _getAllStringVals (IN(RString) key, short flags, IN(RStringArray) values)
void _notifyListener (PropChangeEvents event, IN(RString) key)
void _asCsfLiteral (StringBuffer &sb, IN(RString) keyName, IN(RString) indent, short flags)
void _asCsfLiteral (StringBuffer &sb, IN(RString) indent, short flags, IN(RString) key, IN(RDmiObject) val)
RString _eval (IN(RString) str, short flags)
int _getFlagsFromStringProps (int defaultFlags)
 returns the flags encoded as globals in this props


Private Attributes

short _defaultFlags
short _castFlags
RPropsArray _parents
RHashMap _curHeap
RString _name
bool _singleThreaded
RPropsChangeListenerArray _listeners


Constructor & Destructor Documentation

acdk::cfgscript::Props::Props IN(RString name,
short  flags = PropsNoFlags,
IN(RProps parent = Nil,
bool  private_props = true
 

Parameters:
flags combination of PropsFlags

acdk::cfgscript::Props::Props short  flags = PropsNoFlags,
IN(RProps parent = Nil,
bool  private_props = true
 

acdk::cfgscript::Props::Props IN(acdk::lang::dmi::RDmiNamedArgArray namedArgs,
short  flags = PropsNoFlags
 


Member Function Documentation

void acdk::cfgscript::Props::_asCsfLiteral StringBuffer sb,
IN(RString indent,
short  flags,
IN(RString key,
IN(RDmiObject val
[private]
 

void acdk::cfgscript::Props::_asCsfLiteral StringBuffer sb,
IN(RString keyName,
IN(RString indent,
short  flags
[private]
 

RString acdk::cfgscript::Props::_eval IN(RString str,
short  flags
[private]
 

RDmiObject acdk::cfgscript::Props::_get IN(RString name,
short  flags
[private]
 

unsynchronized version of get

void acdk::cfgscript::Props::_getAllStringVals IN(RString key,
short  flags,
IN(RStringArray values
[private]
 

int acdk::cfgscript::Props::_getFlagsFromStringProps int  defaultFlags  )  [private]
 

returns the flags encoded as globals in this props

void acdk::cfgscript::Props::_getKeys INOUT(::acdk::util::TreeSet keys,
bool  withParents = true
[private]
 

void acdk::cfgscript::Props::_getKeys IN(RStringArray sa  )  [private]
 

bool acdk::cfgscript::Props::_importNameSpace IN(RString prefix,
IN(RProps props
[private]
 

Returns:
true if an value is changed.

void acdk::cfgscript::Props::_init  )  [private]
 

void acdk::cfgscript::Props::_notifyListener PropChangeEvents  event,
IN(RString key
[private]
 

bool acdk::cfgscript::Props::_readParent short  flags  )  [inline, private]
 

void acdk::cfgscript::Props::_set IN(RString name,
IN(RDmiObject val,
short  flags,
bool  notify = true
[private]
 

unsynchronized version of set

bool acdk::cfgscript::Props::_warnRead short  flags  )  [inline, private]
 

bool acdk::cfgscript::Props::_warnWrite short  flags  )  [inline, private]
 

bool acdk::cfgscript::Props::_writeParent short  flags  )  [inline, private]
 

void acdk::cfgscript::Props::addListener IN(RPropsChangeListener listener  ) 
 

void acdk::cfgscript::Props::addParentProps IN(RProps nparent  )  [inline]
 

void acdk::cfgscript::Props::appendObjectList IN(RString key,
IN(acdk::lang::Object val,
short  flags = PropsNoFlags
 

void acdk::cfgscript::Props::appendStringArrayVal IN(RString key,
IN(RString value,
short  flags = PropsNoFlags
 

void acdk::cfgscript::Props::appendStringVal IN(RString key,
IN(RString value,
IN(RString joiner,
short  flags = PropsNoFlags
 

RString acdk::cfgscript::Props::asCfgScriptLiteral IN(RString keyName,
IN(RString indent = ,
short  flags = PropsNoFlags
 

this only works for basic types, Strings, Props and Arrays.

Parameters:
keyName the varname of the property
indent indentation
flags combination of enum PropsFlags

void acdk::cfgscript::Props::assign IN(RString name,
IN(RDmiObject val,
short  flags = PropsNoFlags
 

Assigns value to given name.

Exceptions:
ScriptException if variable name is not definied
ClassCastException if variable type cannot be assigned

acdk::lang::Object acdk::cfgscript::Props::clone  )  [inline, virtual]
 

Implements acdk::lang::Cloneable.

acdk::lang::Object acdk::cfgscript::Props::clone acdk::lang::sys::Allocator alloc  )  [virtual]
 

this clone only clones the underlying HashMap.

Keys and Values itself are not cloned prarents will be cloned too

Reimplemented from acdk::lang::Cloneable.

bool acdk::cfgscript::Props::containsInStringArrayVal IN(RString key,
IN(RString value,
short  flags = PropsNoFlags
 

void acdk::cfgscript::Props::create IN(RString name,
const ::acdk::lang::dmi::ClazzInfo ci
[inline]
 

void acdk::cfgscript::Props::create IN(RString name,
IN(RDmiObject val
 

create a new variable

Exceptions:
ScriptException if variable with same name already is defined in this property

void acdk::cfgscript::Props::dump int  dumpFlags = DumpWithParent,
::acdk::util::RTreeSet  keys = Nil,
IN(RString ident =
 

dumps to System::out

RString acdk::cfgscript::Props::eval IN(RString str,
short  flags = PropsNoFlags
 

evaluates embeeded script parrs

  • ${expr} where expr is either a Props key or a CfgScript expression

  • key} is a key to a StringArray it will be expanded inline in the string if PropsEvalQuoteFileNameArgs is set in the flags the single strings of the StringArray will be quoted to be valid file name arguments.
  • !{ script }! script will be evaluated as CfgScript script. the !{ script }! will be replaced with the output written by the script to 'out'

${CCC} ${CCOPTS} ${OBJDIR}${DIRSEP}${OBJFILE} -c ${SOURCEFILE} After evaluating inplace variable substitution it tries also to eval evalShellExecute if PropsEvalWithShell is set in flags

Parameters:
quoteArgs if true and an replaced parameter contains spaces the expression will be quoted with " on windows or ' on unix.
See also:
 Backtick Operator

RString acdk::cfgscript::Props::evalShellExecute IN(RString str,
short  flags
 

eval embedded backtick commands like `ls`

void acdk::cfgscript::Props::execScript IN(RString str,
IN(RString filename = ,
short  flags = PropsParentRead|PropsParentWrite
 

execute a script

Parameters:
str script content to execute
filename filename of the script to execute (used to find includes)
flags standard property flags

RHashMap acdk::cfgscript::Props::findOwnerHeap IN(RString key  ) 
 

return the container, which owns this key.

Returns:
Nil if no heap owns this key

RDmiObject acdk::cfgscript::Props::get IN(RString name,
short  flags = PropsNoFlags
 

RString acdk::cfgscript::Props::getAcdkHome bool  throwIfNotFound = true  ) 
 

find ACDKHOME or ACDK_HOME in props or System::properties.

RString acdk::cfgscript::Props::getAcdkToolsHome bool  throwIfNotFound = true  ) 
 

RStringArray acdk::cfgscript::Props::getAllStringArrayVal IN(RString key,
short  flags = PropsNoFlags
 

collects in this an parent props all StringArrayVals in a single StringArrayVals

Parameters:
flags if PropsNoStringDups throws away all duplicated string values

RStringArray acdk::cfgscript::Props::getAllStringVals IN(RString key,
short  flags = PropsNoFlags
 

returns all different vals of given key in this and parents

bool acdk::cfgscript::Props::getBoolVal IN(RString key,
short  flags = PropsNoFlags
[inline]
 

short acdk::cfgscript::Props::getCastFlags  )  [inline]
 

a combination of acdk::lang::dmi::ScriptVarCastFlags

short acdk::cfgscript::Props::getDefaultFlags  )  [inline]
 

a combination of PropsFlags

double acdk::cfgscript::Props::getDoubleVal IN(RString key,
short  flags = PropsNoFlags
[inline]
 

RString acdk::cfgscript::Props::getEvaluatedStringVal IN(RString name,
short  flags = PropsNoFlags
[inline]
 

also CfgEval* flags will be needed

See also:
also Props::eval

int acdk::cfgscript::Props::getIntVal IN(RString key,
short  flags = PropsNoFlags
[inline]
 

RStringArray acdk::cfgscript::Props::getKeys short  flags = PropsNoFlags  ) 
 

RString acdk::cfgscript::Props::getName  )  [inline, virtual]
 

returns the ClassName for this object by default

Reimplemented from acdk::lang::Object.

acdk::lang::Object acdk::cfgscript::Props::getObjectVal IN(RString key,
short  flags = PropsNoFlags
[inline]
 

RProps acdk::cfgscript::Props::getParentProps  )  [inline]
 

Deprecated:
see parents

RPropsArray acdk::cfgscript::Props::getParentsProps  )  [inline]
 

RProps acdk::cfgscript::Props::getProps IN(RString name,
short  flags = PropsNoFlags
 

RString acdk::cfgscript::Props::getQuotedStringVal IN(RString key,
short  flags = PropsNoFlags
 

bool acdk::cfgscript::Props::getSingleThreaded  )  [inline]
 

RStringArray acdk::cfgscript::Props::getStringArrayVal IN(RString key,
short  flags = PropsNoFlags
 

return StringArray returns a empty StringArray if not found

RString acdk::cfgscript::Props::getStringVal IN(RString name,
short  flags = PropsNoFlags
 

RString acdk::cfgscript::Props::getUnquotedStringVal IN(RString key,
short  flags = PropsNoFlags
 

equal to getQuoteStringVal, but in case argument is quoted removes quotes before return value

bool acdk::cfgscript::Props::hasParentProps IN(RProps nparent  ) 
 

return true if this or a parent or parent of parent has this props reference

bool acdk::cfgscript::Props::hasValue IN(RString key,
short  flags = PropsNoFlags
[inline]
 

bool acdk::cfgscript::Props::importNameSpace IN(RString prefix  ) 
 

if prefix is PREF imports / overwites KEY = PREF_KEY

Returns:
true if an value is changed.

acdk::util::RIterator acdk::cfgscript::Props::keys  )  [inline]
 

return the iterator of this scope keys

void acdk::cfgscript::Props::lock  )  [inline, virtual]
 

lock the object instance.

Note: Will be overwritten by acdk::io::Reader and acdk::io::Writer Note: if Unsynchronized or isStack is set, this call will have no effect

Reimplemented from acdk::lang::ObjectBase.

RStringArray acdk::cfgscript::Props::makeStringArray IN(RString s1 = Nil,
IN(RString s2 = Nil,
IN(RString s3 = Nil,
IN(RString s4 = Nil,
IN(RString s5 = Nil,
IN(RString s6 = Nil,
IN(RString s7 = Nil,
IN(RString s8 = Nil
[static]
 

helper to create a string array

void acdk::cfgscript::Props::merge IN(RProps other,
short  flags = PropsNoFlags
 

merge other into this props.

Parameters:
other source
flags Combination of PropsMergeFlags

void acdk::cfgscript::Props::removeListener IN(RPropsChangeListener listener  ) 
 

void acdk::cfgscript::Props::removeParentProps IN(RProps nparent  )  [inline]
 

void acdk::cfgscript::Props::reset  )  [inline]
 

reset this props

void acdk::cfgscript::Props::set IN(RString name,
IN(RDmiObject value,
short  flags = PropsNoFlags
 

set a new value

Parameters:
flags a bit combination of PropsOpFlags

void acdk::cfgscript::Props::setBoolVal IN(RString key,
bool  val,
short  flags = PropsNoFlags
[inline]
 

void acdk::cfgscript::Props::setCastFlags short  castFlags  )  [inline]
 

a combination of acdk::lang::dmi::ScriptVarCastFlags

void acdk::cfgscript::Props::setDefaultFlags short  flags  )  [inline]
 

a combination of PropsFlags

void acdk::cfgscript::Props::setDoubleVal IN(RString key,
double  val,
short  flags = PropsNoFlags
[inline]
 

void acdk::cfgscript::Props::setIntVal IN(RString key,
int  val,
short  flags = PropsNoFlags
[inline]
 

void acdk::cfgscript::Props::setName IN(RString name  )  [inline]
 

void acdk::cfgscript::Props::setObjectVal IN(RString key,
IN(acdk::lang::Object value,
short  flags = PropsNoFlags
[inline]
 

void acdk::cfgscript::Props::setProps IN(RString name,
IN(RProps props,
short  flags = PropsNoFlags
[inline]
 

void acdk::cfgscript::Props::setQuotedStringVal IN(RString key,
IN(RString value,
short  flags = PropsNoFlags
 

equal to setStringArrayVal but if value contains spaces CMDLINE_QUOTE_CHAR will be used to quote value

void acdk::cfgscript::Props::setSingleThreaded bool  singleThreaded  )  [inline]
 

void acdk::cfgscript::Props::setStringArrayVal IN(RString key,
IN(RStringArray value,
short  flags = PropsNoFlags
 

void acdk::cfgscript::Props::setStringVal IN(RString key,
IN(RString value,
short  flags = PropsNoFlags
 

int acdk::cfgscript::Props::size short  flags = PropsNoFlags  ) 
 

Returns:
the number of entries in this Props
Parameters:
flags set CfgWithParents if including params

const acdk::lang::dmi::ClazzMethodInfo* acdk::cfgscript::Props::standardDispatch IN(acdk::lang::RString fname,
acdk::lang::dmi::ScriptVar ret,
acdk::lang::dmi::ScriptVarArray args,
acdk::lang::dmi::DmiClient dc,
IN(::acdk::lang::RStringArray namedArgs,
int  flags,
const acdk::lang::dmi::ClazzInfo clazzinfo,
const acdk::lang::dmi::ClazzMethodInfo methinf
 

RString acdk::cfgscript::Props::toString  )  [virtual]
 

return a string representation of this object Object::toString() return getName() by default

Reimplemented from acdk::lang::Object.

void acdk::cfgscript::Props::unlock  )  [inline, virtual]
 

unlock the object instance Note: Will be overwritten by acdk::io::Reader and acdk::io::Writer Note: if Unsynchronized or isStack is set, this call will have no effect

Reimplemented from acdk::lang::ObjectBase.

void acdk::cfgscript::Props::unset IN(RString name,
short  flags = PropsNoFlags
 

removes a key from heap

Parameters:
flags a bit combination of PropsOpFlags


Member Data Documentation

short acdk::cfgscript::Props::_castFlags [private]
 

RHashMap acdk::cfgscript::Props::_curHeap [private]
 

short acdk::cfgscript::Props::_defaultFlags [private]
 

RPropsChangeListenerArray acdk::cfgscript::Props::_listeners [private]
 

RString acdk::cfgscript::Props::_name [private]
 

RPropsArray acdk::cfgscript::Props::_parents [private]
 

bool acdk::cfgscript::Props::_singleThreaded [private]