mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
feature #513: UID, TEMPLATE can be used in context. Also IMAGE template attributes can be referred
This commit is contained in:
parent
5483a1ba92
commit
fc9278f18b
@ -136,6 +136,92 @@ extern "C"
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void get_image_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
const string& img_name,
|
||||
const string& img_value,
|
||||
string& attr_value)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
ImagePool * ipool = nd.get_ipool();
|
||||
Image * img;
|
||||
int iid = -1;
|
||||
string iid_str;
|
||||
|
||||
int num;
|
||||
vector<const Attribute *> attrs;
|
||||
const VectorAttribute * disk;
|
||||
|
||||
attr_value.clear();
|
||||
|
||||
if (img_name.empty() || img_name != "IMAGE_ID")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Check that the image is in the template, so
|
||||
// are sure that we can access the image template
|
||||
// ----------------------------------------------
|
||||
num = vm->get_template_attribute("DISK",attrs);
|
||||
|
||||
for (int i=0; i < num ;i++)
|
||||
{
|
||||
disk = dynamic_cast<const VectorAttribute *>(attrs[i]);
|
||||
|
||||
if ( disk == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
iid_str = disk->vector_value("IMAGE_ID");
|
||||
|
||||
if ( iid_str == img_value )
|
||||
{
|
||||
istringstream iss(img_value);
|
||||
|
||||
iss >> iid;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
iid = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iid == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Get the attribute template from the image
|
||||
// ----------------------------------------------
|
||||
img = ipool->get(iid, true);
|
||||
|
||||
if ( img == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = img->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
img->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
img->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void get_network_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
const string& net_name,
|
||||
@ -146,52 +232,112 @@ void get_network_attribute(VirtualMachine * vm,
|
||||
|
||||
VirtualNetworkPool * vnpool = nd.get_vnpool();
|
||||
VirtualNetwork * vn;
|
||||
int vnet_id = -1;
|
||||
string vnet_id_str;
|
||||
|
||||
string network = "";
|
||||
int num;
|
||||
vector<const Attribute *> attrs;
|
||||
const VectorAttribute * net;
|
||||
|
||||
attr_value = "";
|
||||
attr_value.clear();
|
||||
|
||||
if (net_name.empty())
|
||||
{
|
||||
vector<const Attribute *> nics;
|
||||
const VectorAttribute * nic;
|
||||
|
||||
if (vm->get_template_attribute("NIC",nics) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nic = dynamic_cast<const VectorAttribute * >(nics[0]);
|
||||
|
||||
if ( nic == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
network = nic->vector_value("NETWORK");
|
||||
}
|
||||
else if (net_name == "NAME")
|
||||
{
|
||||
network = net_value;
|
||||
}
|
||||
|
||||
if ( network.empty() )
|
||||
if (net_name.empty() || net_name != "NETWORK_ID")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vn = vnpool->get(network, vm->get_uid(), true);
|
||||
// ----------------------------------------------
|
||||
// Check that the network is in the template, so
|
||||
// are sure that we can access its template
|
||||
// ----------------------------------------------
|
||||
num = vm->get_template_attribute("NIC",attrs);
|
||||
|
||||
for (int i=0; i < num ;i++)
|
||||
{
|
||||
net = dynamic_cast<const VectorAttribute *>(attrs[i]);
|
||||
|
||||
if ( net == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vnet_id_str = net->vector_value("NETWORK_ID");
|
||||
|
||||
if ( vnet_id_str == net_value )
|
||||
{
|
||||
istringstream iss(net_value);
|
||||
|
||||
iss >> vnet_id;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
vnet_id = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (vnet_id == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Get the attribute template from the image
|
||||
// ----------------------------------------------
|
||||
vn = vnpool->get(vnet_id, true);
|
||||
|
||||
if ( vn == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vn->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = vn->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
vn->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
vn->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/*
|
||||
void get_user_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
string& attr_value)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
UserPool * upool = nd.get_upool();
|
||||
User * user;
|
||||
|
||||
attr_value.clear();
|
||||
|
||||
user = upool->get(vm->get_uid(), true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = user->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
user->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
user->unlock();
|
||||
}
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@ -201,9 +347,23 @@ void insert_single(VirtualMachine * vm,
|
||||
{
|
||||
string value = "";
|
||||
|
||||
vm->get_template_attribute(name.c_str(),value);
|
||||
if (name == "TEMPLATE")
|
||||
{
|
||||
vm->to_xml64(value);
|
||||
}
|
||||
else if (name == "UID")
|
||||
{
|
||||
parsed << vm->get_uid();
|
||||
}
|
||||
else
|
||||
{
|
||||
vm->get_template_attribute(name.c_str(),value);
|
||||
}
|
||||
|
||||
parsed << value;
|
||||
if (!value.empty())
|
||||
{
|
||||
parsed << value;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -222,7 +382,7 @@ void insert_vector(VirtualMachine * vm,
|
||||
|
||||
int num;
|
||||
|
||||
if ( name == "NETWORK")
|
||||
if (name == "NETWORK")
|
||||
{
|
||||
string value;
|
||||
|
||||
@ -235,35 +395,50 @@ void insert_vector(VirtualMachine * vm,
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
else if (name == "IMAGE")
|
||||
{
|
||||
string value;
|
||||
|
||||
get_image_attribute(vm,vname,vvar,vval,value);
|
||||
|
||||
if (!value.empty())
|
||||
{
|
||||
parsed << value;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vvar.empty() )
|
||||
{
|
||||
vattr = dynamic_cast<const VectorAttribute *>(values[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VectorAttribute * tmp = 0;
|
||||
|
||||
for (int i=0 ; i < num ; i++)
|
||||
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
{
|
||||
tmp = dynamic_cast<const VectorAttribute *>(values[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( tmp && ( tmp->vector_value(vvar.c_str()) == vval ))
|
||||
if ( vvar.empty() )
|
||||
{
|
||||
vattr = dynamic_cast<const VectorAttribute *>(values[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VectorAttribute * tmp = 0;
|
||||
|
||||
for (int i=0 ; i < num ; i++)
|
||||
{
|
||||
vattr = tmp;
|
||||
break;
|
||||
tmp = dynamic_cast<const VectorAttribute *>(values[i]);
|
||||
|
||||
if ( tmp && ( tmp->vector_value(vvar.c_str()) == vval ))
|
||||
{
|
||||
vattr = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( vattr != 0 )
|
||||
{
|
||||
parsed << vattr->vector_value(vname.c_str());
|
||||
if ( vattr != 0 )
|
||||
{
|
||||
parsed << vattr->vector_value(vname.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,7 +448,7 @@ void insert_vector(VirtualMachine * vm,
|
||||
|
||||
|
||||
/* Line 189 of yacc.c */
|
||||
#line 277 "vm_var_syntax.cc"
|
||||
#line 452 "vm_var_syntax.cc"
|
||||
|
||||
/* Enabling traces. */
|
||||
#ifndef YYDEBUG
|
||||
@ -319,7 +494,7 @@ typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 214 of yacc.c */
|
||||
#line 220 "vm_var_syntax.y"
|
||||
#line 395 "vm_var_syntax.y"
|
||||
|
||||
char * val_str;
|
||||
int val_int;
|
||||
@ -328,7 +503,7 @@ typedef union YYSTYPE
|
||||
|
||||
|
||||
/* Line 214 of yacc.c */
|
||||
#line 332 "vm_var_syntax.cc"
|
||||
#line 507 "vm_var_syntax.cc"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
@ -353,7 +528,7 @@ typedef struct YYLTYPE
|
||||
|
||||
|
||||
/* Line 264 of yacc.c */
|
||||
#line 357 "vm_var_syntax.cc"
|
||||
#line 532 "vm_var_syntax.cc"
|
||||
|
||||
#ifdef short
|
||||
# undef short
|
||||
@ -639,7 +814,7 @@ static const yytype_int8 yyrhs[] =
|
||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const yytype_uint16 yyrline[] =
|
||||
{
|
||||
0, 244, 244, 245, 248, 252, 265, 280
|
||||
0, 419, 419, 420, 423, 427, 440, 455
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -1612,7 +1787,7 @@ yyreduce:
|
||||
case 4:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 249 "vm_var_syntax.y"
|
||||
#line 424 "vm_var_syntax.y"
|
||||
{
|
||||
(*parsed) << (yyvsp[(1) - (1)].val_str);
|
||||
;}
|
||||
@ -1621,7 +1796,7 @@ yyreduce:
|
||||
case 5:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 253 "vm_var_syntax.y"
|
||||
#line 428 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (2)].val_str));
|
||||
|
||||
@ -1639,7 +1814,7 @@ yyreduce:
|
||||
case 6:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 266 "vm_var_syntax.y"
|
||||
#line 441 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (5)].val_str));
|
||||
string vname((yyvsp[(3) - (5)].val_str));
|
||||
@ -1659,7 +1834,7 @@ yyreduce:
|
||||
case 7:
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 281 "vm_var_syntax.y"
|
||||
#line 456 "vm_var_syntax.y"
|
||||
{
|
||||
string name((yyvsp[(1) - (9)].val_str));
|
||||
string vname((yyvsp[(3) - (9)].val_str));
|
||||
@ -1682,7 +1857,7 @@ yyreduce:
|
||||
|
||||
|
||||
/* Line 1464 of yacc.c */
|
||||
#line 1686 "vm_var_syntax.cc"
|
||||
#line 1861 "vm_var_syntax.cc"
|
||||
default: break;
|
||||
}
|
||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
||||
@ -1901,7 +2076,7 @@ yyreturn:
|
||||
|
||||
|
||||
/* Line 1684 of yacc.c */
|
||||
#line 299 "vm_var_syntax.y"
|
||||
#line 474 "vm_var_syntax.y"
|
||||
|
||||
|
||||
extern "C" void vm_var__error(
|
||||
|
@ -57,7 +57,7 @@ typedef union YYSTYPE
|
||||
{
|
||||
|
||||
/* Line 1685 of yacc.c */
|
||||
#line 220 "vm_var_syntax.y"
|
||||
#line 395 "vm_var_syntax.y"
|
||||
|
||||
char * val_str;
|
||||
int val_int;
|
||||
|
@ -74,6 +74,92 @@ extern "C"
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void get_image_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
const string& img_name,
|
||||
const string& img_value,
|
||||
string& attr_value)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
ImagePool * ipool = nd.get_ipool();
|
||||
Image * img;
|
||||
int iid = -1;
|
||||
string iid_str;
|
||||
|
||||
int num;
|
||||
vector<const Attribute *> attrs;
|
||||
const VectorAttribute * disk;
|
||||
|
||||
attr_value.clear();
|
||||
|
||||
if (img_name.empty() || img_name != "IMAGE_ID")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Check that the image is in the template, so
|
||||
// are sure that we can access the image template
|
||||
// ----------------------------------------------
|
||||
num = vm->get_template_attribute("DISK",attrs);
|
||||
|
||||
for (int i=0; i < num ;i++)
|
||||
{
|
||||
disk = dynamic_cast<const VectorAttribute *>(attrs[i]);
|
||||
|
||||
if ( disk == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
iid_str = disk->vector_value("IMAGE_ID");
|
||||
|
||||
if ( iid_str == img_value )
|
||||
{
|
||||
istringstream iss(img_value);
|
||||
|
||||
iss >> iid;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
iid = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iid == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Get the attribute template from the image
|
||||
// ----------------------------------------------
|
||||
img = ipool->get(iid, true);
|
||||
|
||||
if ( img == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = img->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
img->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
img->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void get_network_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
const string& net_name,
|
||||
@ -84,52 +170,112 @@ void get_network_attribute(VirtualMachine * vm,
|
||||
|
||||
VirtualNetworkPool * vnpool = nd.get_vnpool();
|
||||
VirtualNetwork * vn;
|
||||
int vnet_id = -1;
|
||||
string vnet_id_str;
|
||||
|
||||
string network = "";
|
||||
int num;
|
||||
vector<const Attribute *> attrs;
|
||||
const VectorAttribute * net;
|
||||
|
||||
attr_value = "";
|
||||
attr_value.clear();
|
||||
|
||||
if (net_name.empty())
|
||||
{
|
||||
vector<const Attribute *> nics;
|
||||
const VectorAttribute * nic;
|
||||
|
||||
if (vm->get_template_attribute("NIC",nics) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
nic = dynamic_cast<const VectorAttribute * >(nics[0]);
|
||||
|
||||
if ( nic == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
network = nic->vector_value("NETWORK");
|
||||
}
|
||||
else if (net_name == "NAME")
|
||||
{
|
||||
network = net_value;
|
||||
}
|
||||
|
||||
if ( network.empty() )
|
||||
if (net_name.empty() || net_name != "NETWORK_ID")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vn = vnpool->get(network, vm->get_uid(), true);
|
||||
// ----------------------------------------------
|
||||
// Check that the network is in the template, so
|
||||
// are sure that we can access its template
|
||||
// ----------------------------------------------
|
||||
num = vm->get_template_attribute("NIC",attrs);
|
||||
|
||||
for (int i=0; i < num ;i++)
|
||||
{
|
||||
net = dynamic_cast<const VectorAttribute *>(attrs[i]);
|
||||
|
||||
if ( net == 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
vnet_id_str = net->vector_value("NETWORK_ID");
|
||||
|
||||
if ( vnet_id_str == net_value )
|
||||
{
|
||||
istringstream iss(net_value);
|
||||
|
||||
iss >> vnet_id;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
vnet_id = -1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (vnet_id == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Get the attribute template from the image
|
||||
// ----------------------------------------------
|
||||
vn = vnpool->get(vnet_id, true);
|
||||
|
||||
if ( vn == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vn->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = vn->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
vn->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
vn->unlock();
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/*
|
||||
void get_user_attribute(VirtualMachine * vm,
|
||||
const string& attr_name,
|
||||
string& attr_value)
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
UserPool * upool = nd.get_upool();
|
||||
User * user;
|
||||
|
||||
attr_value.clear();
|
||||
|
||||
user = upool->get(vm->get_uid(), true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (attr_name == "TEMPLATE")
|
||||
{
|
||||
attr_value = user->to_xml64(attr_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
user->get_template_attribute(attr_name.c_str(),attr_value);
|
||||
}
|
||||
|
||||
user->unlock();
|
||||
}
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@ -139,9 +285,23 @@ void insert_single(VirtualMachine * vm,
|
||||
{
|
||||
string value = "";
|
||||
|
||||
vm->get_template_attribute(name.c_str(),value);
|
||||
if (name == "TEMPLATE")
|
||||
{
|
||||
vm->to_xml64(value);
|
||||
}
|
||||
else if (name == "UID")
|
||||
{
|
||||
parsed << vm->get_uid();
|
||||
}
|
||||
else
|
||||
{
|
||||
vm->get_template_attribute(name.c_str(),value);
|
||||
}
|
||||
|
||||
parsed << value;
|
||||
if (!value.empty())
|
||||
{
|
||||
parsed << value;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -160,7 +320,7 @@ void insert_vector(VirtualMachine * vm,
|
||||
|
||||
int num;
|
||||
|
||||
if ( name == "NETWORK")
|
||||
if (name == "NETWORK")
|
||||
{
|
||||
string value;
|
||||
|
||||
@ -173,35 +333,50 @@ void insert_vector(VirtualMachine * vm,
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
else if (name == "IMAGE")
|
||||
{
|
||||
string value;
|
||||
|
||||
get_image_attribute(vm,vname,vvar,vval,value);
|
||||
|
||||
if (!value.empty())
|
||||
{
|
||||
parsed << value;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( vvar.empty() )
|
||||
{
|
||||
vattr = dynamic_cast<const VectorAttribute *>(values[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VectorAttribute * tmp = 0;
|
||||
|
||||
for (int i=0 ; i < num ; i++)
|
||||
if ( ( num = vm->get_template_attribute(name.c_str(),values) ) <= 0 )
|
||||
{
|
||||
tmp = dynamic_cast<const VectorAttribute *>(values[i]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( tmp && ( tmp->vector_value(vvar.c_str()) == vval ))
|
||||
if ( vvar.empty() )
|
||||
{
|
||||
vattr = dynamic_cast<const VectorAttribute *>(values[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const VectorAttribute * tmp = 0;
|
||||
|
||||
for (int i=0 ; i < num ; i++)
|
||||
{
|
||||
vattr = tmp;
|
||||
break;
|
||||
tmp = dynamic_cast<const VectorAttribute *>(values[i]);
|
||||
|
||||
if ( tmp && ( tmp->vector_value(vvar.c_str()) == vval ))
|
||||
{
|
||||
vattr = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( vattr != 0 )
|
||||
{
|
||||
parsed << vattr->vector_value(vname.c_str());
|
||||
if ( vattr != 0 )
|
||||
{
|
||||
parsed << vattr->vector_value(vname.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user