Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
ArcSec::StringAttribute Class Reference

#include <StringAttribute.h>

Inheritance diagram for ArcSec::StringAttribute:
Inheritance graph
[legend]
Collaboration diagram for ArcSec::StringAttribute:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StringAttribute ()
 StringAttribute (const std::string &v, const std::string &i)
virtual ~StringAttribute ()
virtual bool equal (AttributeValue *other, bool check_id=true)
 Evluate whether "this" equale to the parameter value.
virtual bool inrange (AttributeValue *other)
virtual std::string encode ()
 encode the value in a string format
std::string getValue ()
virtual std::string getType ()
 Get the DataType of the <Attribute>
virtual std::string getId ()
 Get the AttributeId of the <Attribute>

Static Public Member Functions

static const std::string & getIdentifier (void)

Private Attributes

std::string value
std::string id

Static Private Attributes

static std::string identifier = "string"

Detailed Description

Definition at line 7 of file StringAttribute.h.


Constructor & Destructor Documentation

Definition at line 14 of file StringAttribute.h.

{ };
ArcSec::StringAttribute::StringAttribute ( const std::string &  v,
const std::string &  i 
) [inline]

Definition at line 15 of file StringAttribute.h.

: value(v), id(i){ };
virtual ArcSec::StringAttribute::~StringAttribute ( ) [inline, virtual]

Definition at line 16 of file StringAttribute.h.

{ };

Member Function Documentation

virtual std::string ArcSec::StringAttribute::encode ( ) [inline, virtual]

encode the value in a string format

Implements ArcSec::AttributeValue.

Definition at line 20 of file StringAttribute.h.

{return value;};
bool ArcSec::StringAttribute::equal ( AttributeValue value,
bool  check_id = true 
) [virtual]

Evluate whether "this" equale to the parameter value.

Implements ArcSec::AttributeValue.

Definition at line 12 of file StringAttribute.cpp.

                                                           {
  StringAttribute *other;
  try{
    other = dynamic_cast<StringAttribute*>(o);
  } catch(std::exception&) { };
  if(other==NULL){
    //std::cerr<<"not StringAttribute"<<std::endl;
    return false;
  }
  if(check_id) { if(id != other->id) return false; }
  if((value.compare(other->getValue()))==0)
    return true;
  else
    return false;
}

Here is the call graph for this function:

virtual std::string ArcSec::StringAttribute::getId ( ) [inline, virtual]

Get the AttributeId of the <Attribute>

Implements ArcSec::AttributeValue.

Definition at line 23 of file StringAttribute.h.

{return id;};
static const std::string& ArcSec::StringAttribute::getIdentifier ( void  ) [inline, static]

Definition at line 24 of file StringAttribute.h.

{ return identifier; };

Here is the caller graph for this function:

virtual std::string ArcSec::StringAttribute::getType ( ) [inline, virtual]

Get the DataType of the <Attribute>

Implements ArcSec::AttributeValue.

Definition at line 22 of file StringAttribute.h.

{return identifier; };
std::string ArcSec::StringAttribute::getValue ( ) [inline]

Definition at line 21 of file StringAttribute.h.

{ return value; };

Here is the caller graph for this function:

bool ArcSec::StringAttribute::inrange ( AttributeValue other) [virtual]

Definition at line 28 of file StringAttribute.cpp.

                                              {
  StringAttribute *other;
  try{
    other = dynamic_cast<StringAttribute*>(o);
  } catch(std::exception&) { };
  if(other==NULL){
    //std::cerr<<"not StringAttribute"<<std::endl;
    return false;
  }
  if(id != other->id) return false;

  //if there is a few values in the policy side, e.g.
  //<Attribute AttributeId="urn:arc:fileoperation">read; write; delete</Attribute>
  std::string other_value = other->getValue();

  size_t p1, p2;
  std::string str, str1, str2;
  str = value;

  do {
    p1 = str.find_first_not_of(" ");
    p2 = str.find_first_of(";");
    if(p2!=std::string::npos)
      str1 = str.substr(p1,p2-p1);
    else str1 = str.substr(p1);
    
    size_t f1, f2;
    std::string o_str, o_str1, o_str2;
    o_str = other_value;
    bool match = false;
    do {
      f1 = o_str.find_first_not_of(" ");
      f2 = o_str.find_first_of(";");
      if(f2!=std::string::npos)
        o_str1 = o_str.substr(f1,f2-f1);
      else o_str1 = o_str.substr(f1);
      if((o_str1.compare(str1)) == 0) {
        match = true; break;
      }
      o_str2=o_str.substr(f2+1);
      o_str.clear(); o_str = o_str2; o_str2.clear();
    } while(f2!=std::string::npos);
    
    if(match == false) {return false;};

    str2=str.substr(p2+1);
    str.clear(); str = str2; str2.clear();

  } while(p2!=std::string::npos);

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::string ArcSec::StringAttribute::id [private]

Definition at line 11 of file StringAttribute.h.

std::string ArcSec::StringAttribute::identifier = "string" [static, private]

Definition at line 9 of file StringAttribute.h.

std::string ArcSec::StringAttribute::value [private]

Definition at line 10 of file StringAttribute.h.


The documentation for this class was generated from the following files: