mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-26 09:57:23 +03:00
bug #847: Added method to get & erase an attribute. Cleaned up prototypes
This commit is contained in:
parent
d27d994431
commit
6c55f347ec
@ -181,7 +181,6 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
// Template
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Gets the values of a template attribute
|
||||
* @param name of the attribute
|
||||
@ -189,26 +188,12 @@ public:
|
||||
* @return the number of values
|
||||
*/
|
||||
int get_template_attribute(
|
||||
string& name,
|
||||
const char * name,
|
||||
vector<const Attribute*>& values) const
|
||||
{
|
||||
return obj_template->get(name,values);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the values of a template attribute
|
||||
* @param name of the attribute
|
||||
* @param values of the attribute
|
||||
* @return the number of values
|
||||
*/
|
||||
int get_template_attribute(
|
||||
const char *name,
|
||||
vector<const Attribute*>& values) const
|
||||
{
|
||||
string str=name;
|
||||
return obj_template->get(str,values);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets a string based attribute (single)
|
||||
* @param name of the attribute
|
||||
@ -216,11 +201,25 @@ public:
|
||||
* not a single attribute
|
||||
*/
|
||||
void get_template_attribute(
|
||||
const char * name,
|
||||
string& value) const
|
||||
const char * name,
|
||||
string& value) const
|
||||
{
|
||||
string str=name;
|
||||
obj_template->get(str,value);
|
||||
obj_template->get(name,value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an removes a string based attribute (single)
|
||||
* @param name of the attribute
|
||||
* @param value of the attribute (a string), will be "" if not defined or
|
||||
* not a single attribute
|
||||
* @return the number of attributes erased
|
||||
*/
|
||||
int erase_template_attribute(
|
||||
const char * name,
|
||||
string& value) const
|
||||
{
|
||||
obj_template->get(name,value);
|
||||
return obj_template->erase(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -233,8 +232,7 @@ public:
|
||||
const char * name,
|
||||
int& value) const
|
||||
{
|
||||
string str=name;
|
||||
obj_template->get(str,value);
|
||||
obj_template->get(name,value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
* defined or not Single
|
||||
*/
|
||||
virtual void get(
|
||||
string& name,
|
||||
const string& name,
|
||||
string& value) const;
|
||||
|
||||
/**
|
||||
@ -178,7 +178,7 @@ public:
|
||||
* @return True if the Single attribute was found
|
||||
*/
|
||||
virtual bool get(
|
||||
string& name,
|
||||
const string& name,
|
||||
int& value) const;
|
||||
|
||||
friend ostream& operator<<(ostream& os, const Template& t);
|
||||
|
@ -275,15 +275,12 @@ int Template::get(
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void Template::get(
|
||||
string& name,
|
||||
const string& name,
|
||||
string& value) const
|
||||
{
|
||||
vector<const Attribute *> attrs;
|
||||
const SingleAttribute * sattr;
|
||||
int rc;
|
||||
|
||||
transform (name.begin(),name.end(),name.begin(),(int(*)(int))toupper);
|
||||
|
||||
rc = get(name,attrs);
|
||||
|
||||
if (rc == 0)
|
||||
@ -308,7 +305,7 @@ void Template::get(
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
bool Template::get(
|
||||
string& name,
|
||||
const string& name,
|
||||
int& value) const
|
||||
{
|
||||
string sval;
|
||||
|
Loading…
x
Reference in New Issue
Block a user