Commit 71df0ff0 authored by Ben Boeckel's avatar Ben Boeckel

style: remove separator comments

parent 16252d73
......@@ -14,20 +14,14 @@ class_types = set([
])
scope_types = class_types.union(['namespace-type'])
#------------------------------------------------------------------------------
def mangleQualifiedName(name):
return name.replace('::', '_')
#------------------------------------------------------------------------------
def mangleTemplateArgs(args):
return mangleQualifiedName(args.replace(' ', '').replace(',', '_'))
#------------------------------------------------------------------------------
def typeName(attrs):
if 'template' in attrs:
......@@ -36,30 +30,23 @@ def typeName(attrs):
else:
return mangleQualifiedName(attrs['name'])
#==============================================================================
class typesystem_parser(xml.sax.ContentHandler):
#-------------------------------------------------------------------------
def __init__(self):
self.current_namespace = []
self.package_name = None
self.package_prefix_path = None
#-------------------------------------------------------------------------
def printFile(self, name):
print os.path.join(self.package_prefix_path, name.lower())
#-------------------------------------------------------------------------
def printFiles(self, prefix, extensions):
for extension in extensions:
self.printFile(prefix + '.' + extension)
#-------------------------------------------------------------------------
def printWrapperFiles(self, names):
self.printFiles('_'.join(names) + '_wrapper', ['cpp', 'h'])
#-------------------------------------------------------------------------
def startElement(self, name, attrs):
if name == 'typesystem':
self.package_name = attrs['package']
......@@ -88,13 +75,11 @@ class typesystem_parser(xml.sax.ContentHandler):
if(generate):
self.printWrapperFiles(self.current_namespace)
#-------------------------------------------------------------------------
def endElement(self, name):
if name in scope_types:
self.current_namespace.pop()
#==============================================================================
if __name__ == '__main__':
if len(sys.argv) < 3:
sys.exit(1)
......
......@@ -44,7 +44,6 @@ SMTK_THIRDPARTY_POST_INCLUDE
using namespace smtk::attribute;
using namespace smtk::common;
//----------------------------------------------------------------------------
Attribute::Attribute(const std::string &myName,
smtk::attribute::DefinitionPtr myDefinition,
const smtk::common::UUID &myId):
......@@ -55,7 +54,6 @@ Attribute::Attribute(const std::string &myName,
this->m_definition->buildAttribute(this);
}
//----------------------------------------------------------------------------
Attribute::Attribute(const std::string &myName,
smtk::attribute::DefinitionPtr myDefinition):
m_name(myName), m_definition(myDefinition),
......@@ -67,7 +65,6 @@ Attribute::Attribute(const std::string &myName,
this->m_definition->buildAttribute(this);
}
//----------------------------------------------------------------------------
Attribute::~Attribute()
{
this->m_aboutToBeDeleted = true;
......@@ -83,7 +80,7 @@ Attribute::~Attribute()
}
this->removeAllItems();
}
//----------------------------------------------------------------------------
void Attribute::removeAllItems()
{
// we need to detatch all items owned bu this attribute
......@@ -94,7 +91,7 @@ void Attribute::removeAllItems()
}
this->m_items.clear();
}
//----------------------------------------------------------------------------
void Attribute::references(std::vector<smtk::attribute::ItemPtr> &list) const
{
list.clear();
......@@ -107,7 +104,7 @@ void Attribute::references(std::vector<smtk::attribute::ItemPtr> &list) const
}
}
}
//----------------------------------------------------------------------------
const double *Attribute::color() const
{
if (this->m_isColorSet)
......@@ -116,12 +113,12 @@ const double *Attribute::color() const
}
return this->m_definition->defaultColor();
}
//----------------------------------------------------------------------------
const std::string &Attribute::type() const
{
return this->m_definition->type();
}
//----------------------------------------------------------------------------
std::vector<std::string> Attribute::types() const
{
std::vector<std::string> tvec;
......@@ -133,17 +130,17 @@ std::vector<std::string> Attribute::types() const
}
return tvec;
}
//----------------------------------------------------------------------------
bool Attribute::isA(smtk::attribute::DefinitionPtr def) const
{
return this->m_definition->isA(def);
}
///----------------------------------------------------------------------------
bool Attribute::isMemberOf(const std::string &category) const
{
return this->m_definition->isMemberOf(category);
}
//----------------------------------------------------------------------------
bool Attribute::isMemberOf(const std::vector<std::string> &categories) const
{
return this->m_definition->isMemberOf(categories);
......@@ -258,12 +255,11 @@ bool Attribute::isValid() const
return true;
}
//----------------------------------------------------------------------------
System *Attribute::system() const
{
return this->m_definition->system();
}
//----------------------------------------------------------------------------
/**\brief Return the model Manager instance whose entities may have attributes.
*
* This returns a shared pointer to smtk::model::Manager, which may be
......@@ -280,7 +276,7 @@ smtk::model::ManagerPtr Attribute::modelManager() const
}
return result;
}
//----------------------------------------------------------------------------
/**\brief Remove all associations of this attribute with model entities.
*
* Note that this actually resets the associations.
......@@ -426,7 +422,7 @@ void Attribute::disassociateEntity(const smtk::common::UUID& entity, bool revers
}
}
}
//----------------------------------------------------------------------------
/**\brief Disassociate a new-style model entity (a EntityRef) from this attribute.
*
*/
......@@ -481,7 +477,6 @@ smtk::attribute::ItemPtr Attribute::find(
this->m_items[static_cast<std::size_t>(i)];
}
//----------------------------------------------------------------------------
smtk::attribute::ConstItemPtr Attribute::find(
const std::string& inName,
SearchStyle style
......@@ -508,7 +503,6 @@ smtk::attribute::ConstItemPtr Attribute::find(
smtk::const_pointer_cast<const Item>(this->m_items[static_cast<std::size_t>(i)]);
}
//-----------------------------------------------------------------------------
smtk::attribute::IntItemPtr Attribute::findInt(const std::string &nameStr)
{ return smtk::dynamic_pointer_cast<IntItem>(this->find(nameStr)); }
smtk::attribute::ConstIntItemPtr Attribute::findInt(const std::string &nameStr) const
......
......@@ -240,14 +240,14 @@ namespace smtk
double m_color[4];
#endif // SHIBOKEN_SKIP
};
//----------------------------------------------------------------------------
inline smtk::simulation::UserDataPtr Attribute::userData(const std::string &key) const
{
std::map<std::string, smtk::simulation::UserDataPtr >::const_iterator it =
this->m_userData.find(key);
return ((it == this->m_userData.end()) ? smtk::simulation::UserDataPtr() : it->second);
}
//----------------------------------------------------------------------------
inline void Attribute::setColor(double r, double g, double b, double a)
{
this->m_isColorSet = true;
......@@ -257,7 +257,6 @@ namespace smtk
this->m_color[3]= a;
}
//----------------------------------------------------------------------------
template<typename T> T Attribute::modelEntitiesAs(const std::string& iname) const
{
T result;
......@@ -278,7 +277,7 @@ namespace smtk
}
return result;
}
//----------------------------------------------------------------------------
template<typename T> T Attribute::associatedModelEntities() const
{
T result;
......@@ -298,7 +297,7 @@ namespace smtk
}
return result;
}
//----------------------------------------------------------------------------
/**\brief Return an item given its path, converted to a given pointer type.
*/
template<typename T>
......@@ -313,19 +312,18 @@ namespace smtk
}
return result;
}
//----------------------------------------------------------------------------
template<typename T>
typename T::Ptr Attribute::findAs(const std::string& iname, SearchStyle style)
{
return smtk::dynamic_pointer_cast<T>(this->find(iname, style));
}
//----------------------------------------------------------------------------
template<typename T>
typename T::ConstPtr Attribute::findAs(const std::string& iname, SearchStyle style) const
{
return smtk::dynamic_pointer_cast<const T>(this->find(iname, style));
}
//----------------------------------------------------------------------------
} // attribute namespace
} // smtk namespace
......
......@@ -17,31 +17,26 @@ namespace smtk {
namespace attribute {
//----------------------------------------------------------------------------
DateTimeItem::DateTimeItem(Attribute *owningAttribute, int itemPosition):
Item(owningAttribute, itemPosition)
{
}
//----------------------------------------------------------------------------
DateTimeItem::DateTimeItem(
Item *inOwningAttribute, int itemPosition, int mySubGroupPosition):
Item(inOwningAttribute, itemPosition, mySubGroupPosition)
{
}
//----------------------------------------------------------------------------
DateTimeItem::~DateTimeItem()
{
}
//----------------------------------------------------------------------------
Item::Type DateTimeItem::type() const
{
return Item::DATE_TIME;
}
//----------------------------------------------------------------------------
bool DateTimeItem::isValid() const
{
// If the item is not enabled or if all of its values are set then it is valid
......@@ -60,7 +55,6 @@ bool DateTimeItem::isValid() const
return true;
}
//----------------------------------------------------------------------------
bool DateTimeItem::setNumberOfValues(std::size_t newSize)
{
if (newSize != this->numberOfRequiredValues())
......@@ -82,7 +76,6 @@ bool DateTimeItem::setNumberOfValues(std::size_t newSize)
return true;
}
//----------------------------------------------------------------------------
std::size_t DateTimeItem::numberOfRequiredValues() const
{
ConstDateTimeItemDefinitionPtr def = this->itemDefinition();
......@@ -93,7 +86,6 @@ std::size_t DateTimeItem::numberOfRequiredValues() const
return def->numberOfRequiredValues();
}
//----------------------------------------------------------------------------
bool DateTimeItem::setValue(
size_t element, const ::smtk::common::DateTimeZonePair& value)
{
......@@ -109,7 +101,6 @@ bool DateTimeItem::setValue(
return false;
}
//----------------------------------------------------------------------------
void DateTimeItem::reset()
{
this->m_isSet.clear();
......@@ -129,7 +120,6 @@ void DateTimeItem::reset()
}
}
//----------------------------------------------------------------------------
bool DateTimeItem::setToDefault(std::size_t element)
{
ConstDateTimeItemDefinitionPtr def = this->itemDefinition();
......@@ -143,7 +133,6 @@ bool DateTimeItem::setToDefault(std::size_t element)
return false;
}
//----------------------------------------------------------------------------
bool DateTimeItem::isUsingDefault(std::size_t element) const
{
assert(this->m_isSet.size() > element);
......@@ -157,7 +146,6 @@ bool DateTimeItem::isUsingDefault(std::size_t element) const
return this->m_values[element] == defaultVal;
}
//----------------------------------------------------------------------------
bool DateTimeItem::isUsingDefault() const
{
ConstDateTimeItemDefinitionPtr def = itemDefinition();
......@@ -179,7 +167,6 @@ bool DateTimeItem::isUsingDefault() const
return true;
}
//----------------------------------------------------------------------------
bool DateTimeItem::assign(ConstItemPtr &sourceItem, unsigned int options)
{
// Assigns my contents to be same as sourceItem
......@@ -206,7 +193,6 @@ bool DateTimeItem::assign(ConstItemPtr &sourceItem, unsigned int options)
return Item::assign(sourceItem, options);
}
//----------------------------------------------------------------------------
bool DateTimeItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr def)
{
if (!def || (!Item::setDefinition(def)))
......@@ -235,7 +221,6 @@ bool DateTimeItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr def)
return true;
}
//----------------------------------------------------------------------------
ConstDateTimeItemDefinitionPtr DateTimeItem::itemDefinition() const
{
ConstDateTimeItemDefinitionPtr def =
......@@ -243,7 +228,5 @@ ConstDateTimeItemDefinitionPtr DateTimeItem::itemDefinition() const
return def;
}
//----------------------------------------------------------------------------
} // namespace attribute
} // namespace smtk
......@@ -15,7 +15,6 @@
namespace sc = smtk::common;
using namespace smtk::attribute;
//----------------------------------------------------------------------------
DateTimeItemDefinition::DateTimeItemDefinition(const std::string &myName):
ItemDefinition(myName),
m_hasDefault(false), m_numberOfRequiredValues(1),
......@@ -23,18 +22,15 @@ DateTimeItemDefinition::DateTimeItemDefinition(const std::string &myName):
{
}
//----------------------------------------------------------------------------
DateTimeItemDefinition::~DateTimeItemDefinition()
{
}
//----------------------------------------------------------------------------
Item::Type DateTimeItemDefinition::type() const
{
return Item::DATE_TIME;
}
//----------------------------------------------------------------------------
bool DateTimeItemDefinition::setDefaultValue(const sc::DateTimeZonePair& value)
{
this->m_defaultValue = value;
......@@ -42,14 +38,12 @@ bool DateTimeItemDefinition::setDefaultValue(const sc::DateTimeZonePair& value)
return true;
}
//----------------------------------------------------------------------------
bool DateTimeItemDefinition::setNumberOfRequiredValues(std::size_t esize)
{
this->m_numberOfRequiredValues = esize;
return true;
}
//----------------------------------------------------------------------------
bool DateTimeItemDefinition::isValueValid(const sc::DateTimeZonePair& /*value*/) const
{
// Currently, all values are valid
......@@ -57,7 +51,6 @@ bool DateTimeItemDefinition::isValueValid(const sc::DateTimeZonePair& /*value*/)
return true;
}
//----------------------------------------------------------------------------
smtk::attribute::ItemPtr
DateTimeItemDefinition::buildItem(Attribute *owningAttribute,
int itemPosition) const
......@@ -66,7 +59,6 @@ DateTimeItemDefinition::buildItem(Attribute *owningAttribute,
new DateTimeItem(owningAttribute, itemPosition));
}
//----------------------------------------------------------------------------
smtk::attribute::ItemPtr
DateTimeItemDefinition::buildItem(Item *owningItem,
int itemPosition,
......@@ -76,7 +68,6 @@ DateTimeItemDefinition::buildItem(Item *owningItem,
new DateTimeItem(owningItem, itemPosition, subGroupPosition));
}
//----------------------------------------------------------------------------
ItemDefinitionPtr DateTimeItemDefinition::createCopy(
ItemDefinition::CopyInfo& info) const
{
......@@ -96,4 +87,3 @@ ItemDefinitionPtr DateTimeItemDefinition::createCopy(
return newDef;
}
//----------------------------------------------------------------------------
......@@ -25,7 +25,6 @@ using namespace smtk::attribute;
double Definition::s_notApplicableBaseColor[4] = {0.0, 0.0, 0.0, 0.0};
double Definition::s_defaultBaseColor[4] = {1.0, 1.0, 1.0, 1.0};
//----------------------------------------------------------------------------
Definition::Definition(
const std::string &myType,
smtk::attribute::DefinitionPtr myBaseDef,
......@@ -53,11 +52,11 @@ Definition::Definition(
this->m_baseItemOffset = 0;
}
}
//----------------------------------------------------------------------------
Definition::~Definition()
{
}
//----------------------------------------------------------------------------
bool Definition::isA(smtk::attribute::ConstDefinitionPtr targetDef) const
{
// Walk up the inheritence tree until we either hit the root or
......@@ -72,7 +71,7 @@ bool Definition::isA(smtk::attribute::ConstDefinitionPtr targetDef) const
}
return false;
}
//----------------------------------------------------------------------------
bool Definition::conflicts(smtk::attribute::DefinitionPtr def) const
{
// 2 definitions conflict if their inheritance tree intersects and isUnique is
......@@ -224,7 +223,7 @@ Definition::canBeAssociated(smtk::model::EntityRef /*entity*/,
// definition. All conflicting attributes gets added to the list.
return false;
}
//----------------------------------------------------------------------------
void Definition::buildAttribute(Attribute *att) const
{
// If there is a super definition have it prep the attribute and add its items
......@@ -262,7 +261,7 @@ void Definition::buildAttribute(Attribute *att) const
att->addItem(comp);
}
}
//----------------------------------------------------------------------------
bool Definition::isMemberOf(const std::vector<std::string> &inCategories) const
{
std::size_t i, n = inCategories.size();
......@@ -273,7 +272,7 @@ bool Definition::isMemberOf(const std::vector<std::string> &inCategories) const
}
return false;
}
//----------------------------------------------------------------------------
bool Definition::addItemDefinition(smtk::attribute::ItemDefinitionPtr cdef)
{
// First see if there is a item by the same name
......@@ -287,7 +286,7 @@ bool Definition::addItemDefinition(smtk::attribute::ItemDefinitionPtr cdef)
this->updateDerivedDefinitions();
return true;
}
//----------------------------------------------------------------------------
void Definition::updateDerivedDefinitions()
{
DefinitionPtr def = this->shared_from_this();
......@@ -296,7 +295,7 @@ void Definition::updateDerivedDefinitions()
this->m_system->updateDerivedDefinitionIndexOffsets(def);
}
}
//----------------------------------------------------------------------------
void Definition::setCategories()
{
if (this->m_baseDefinition)
......@@ -315,7 +314,7 @@ void Definition::setCategories()
this->m_categories.insert(itemCats.begin(), itemCats.end());
}
}
//----------------------------------------------------------------------------
smtk::attribute::ItemDefinitionPtr Definition::itemDefinition(int ith) const
{
// Is the item in this defintion?
......@@ -330,7 +329,7 @@ smtk::attribute::ItemDefinitionPtr Definition::itemDefinition(int ith) const
}
return smtk::attribute::ItemDefinitionPtr();
}
//----------------------------------------------------------------------------
int Definition::findItemPosition(const std::string &name) const
{
std::map<std::string, int>::const_iterator it;
......@@ -349,4 +348,3 @@ int Definition::findItemPosition(const std::string &name) const
}
return it->second + static_cast<int>(this->m_baseItemOffset);
}
//----------------------------------------------------------------------------
......@@ -281,7 +281,7 @@ namespace smtk
double m_defaultColor[4];
};
//----------------------------------------------------------------------------
inline void Definition::resetItemOffset()
{
if (this->m_baseDefinition)
......@@ -289,7 +289,7 @@ namespace smtk
this->m_baseItemOffset = this->m_baseDefinition->numberOfItemDefinitions();
}
}
//----------------------------------------------------------------------------
inline const double * Definition::notApplicableColor() const
{
if (this->m_isNotApplicableColorSet)
......@@ -302,7 +302,7 @@ namespace smtk
}
return s_notApplicableBaseColor;
}
//----------------------------------------------------------------------------
inline void Definition::setNotApplicableColor(
double r, double g, double b, double a)
{
......@@ -312,7 +312,7 @@ namespace smtk
this->m_notApplicableColor[2]= b;
this->m_notApplicableColor[3]= a;
}
//----------------------------------------------------------------------------
inline const double * Definition::defaultColor() const
{
if (this->m_isDefaultColorSet)
......@@ -325,7 +325,7 @@ namespace smtk
}
return s_defaultBaseColor;
}
//----------------------------------------------------------------------------
inline void Definition::setDefaultColor(
double r, double g, double b, double a)
{
......
......@@ -17,14 +17,12 @@
using namespace smtk::attribute;