Commit b2f4c750 authored by Bob Obara's avatar Bob Obara

STYLE: Changing the convension for refereing to data members

Since data members should start with a m_ you no longer need to refre to them
via the this pointer so this->m_foo is now just m_foo
parent d7aba582
......@@ -57,7 +57,7 @@ Attribute::Attribute(const std::string& myName, smtk::attribute::DefinitionPtr m
, m_aboutToBeDeleted(false)
, m_id(myId)
{
this->m_definition->buildAttribute(this);
m_definition->buildAttribute(this);
}
Attribute::Attribute(const std::string& myName, smtk::attribute::DefinitionPtr myDefinition)
......@@ -70,15 +70,15 @@ Attribute::Attribute(const std::string& myName, smtk::attribute::DefinitionPtr m
, m_aboutToBeDeleted(false)
, m_id(smtk::common::UUIDGenerator::instance().random())
{
this->m_definition->buildAttribute(this);
m_definition->buildAttribute(this);
}
Attribute::~Attribute()
{
this->m_aboutToBeDeleted = true;
m_aboutToBeDeleted = true;
// Clear all references to the attribute
std::map<smtk::attribute::RefItem*, std::set<std::size_t> >::iterator it;
for (it = this->m_references.begin(); it != this->m_references.end(); it++)
for (it = m_references.begin(); it != m_references.end(); it++)
{
std::set<std::size_t>::iterator sit;
for (sit = it->second.begin(); sit != it->second.end(); sit++)
......@@ -92,19 +92,19 @@ Attribute::~Attribute()
void Attribute::removeAllItems()
{
// we need to detatch all items owned by this attribute
std::size_t i, n = this->m_items.size();
std::size_t i, n = m_items.size();
for (i = 0; i < n; i++)
{
this->m_items[i]->detachOwningAttribute();
m_items[i]->detachOwningAttribute();
}
this->m_items.clear();
m_items.clear();
}
void Attribute::references(std::vector<smtk::attribute::ItemPtr>& list) const
{
list.clear();
std::map<smtk::attribute::RefItem*, std::set<std::size_t> >::const_iterator it;
for (it = this->m_references.begin(); it != this->m_references.end(); it++)
for (it = m_references.begin(); it != m_references.end(); it++)
{
if (it->second.size())
{
......@@ -115,22 +115,22 @@ void Attribute::references(std::vector<smtk::attribute::ItemPtr>& list) const
const double* Attribute::color() const
{
if (this->m_isColorSet)
if (m_isColorSet)
{
return this->m_color;
return m_color;
}
return this->m_definition->defaultColor();
return m_definition->defaultColor();
}
const std::string& Attribute::type() const
{
return this->m_definition->type();
return m_definition->type();
}
std::vector<std::string> Attribute::types() const
{
std::vector<std::string> tvec;
smtk::attribute::DefinitionPtr def = this->m_definition;
smtk::attribute::DefinitionPtr def = m_definition;
while (def)
{
tvec.push_back(def->type());
......@@ -141,17 +141,17 @@ std::vector<std::string> Attribute::types() const
bool Attribute::isA(smtk::attribute::DefinitionPtr def) const
{
return this->m_definition->isA(def);
return m_definition->isA(def);
}
bool Attribute::isMemberOf(const std::string& category) const
{
return this->m_definition->isMemberOf(category);
return m_definition->isMemberOf(category);
}
bool Attribute::isMemberOf(const std::vector<std::string>& categories) const
{
return this->m_definition->isMemberOf(categories);
return m_definition->isMemberOf(categories);
}
/**\brief Return an item given a string specifying a path to it.
......@@ -255,7 +255,7 @@ bool Attribute::isValid() const
}
}
// also check associations
if (this->m_associations && !this->m_associations->isValid())
if (m_associations && !m_associations->isValid())
{
return false;
}
......@@ -264,7 +264,7 @@ bool Attribute::isValid() const
CollectionPtr Attribute::collection() const
{
return this->m_definition->collection();
return m_definition->collection();
}
const smtk::resource::ResourcePtr Attribute::resource() const
......@@ -298,18 +298,18 @@ smtk::model::ManagerPtr Attribute::modelManager() const
void Attribute::removeAllAssociations()
{
smtk::model::ManagerPtr modelMgr = this->modelManager();
if (modelMgr && this->m_associations)
if (modelMgr && m_associations)
{
smtk::model::EntityRefArray::const_iterator it;
for (it = this->m_associations->begin(); it != this->m_associations->end(); ++it)
for (it = m_associations->begin(); it != m_associations->end(); ++it)
{
modelMgr->disassociateAttribute(this->collection(), this->id(), it->entity(), false);
}
}
if (this->m_associations)
if (m_associations)
{
this->m_associations->reset();
m_associations->reset();
}
}
......@@ -372,7 +372,7 @@ bool Attribute::isComponentAssociated(const smtk::resource::ComponentPtr& comp)
*/
bool Attribute::isEntityAssociated(const smtk::common::UUID& entity) const
{
return this->m_associations ? this->m_associations->has(entity) : false;
return m_associations ? m_associations->has(entity) : false;
}
/**\brief Is the model entity of the \a entityref associated with this attribute?
......@@ -380,7 +380,7 @@ bool Attribute::isEntityAssociated(const smtk::common::UUID& entity) const
*/
bool Attribute::isEntityAssociated(const smtk::model::EntityRef& entityref) const
{
return this->m_associations ? this->m_associations->has(entityref) : false;
return m_associations ? m_associations->has(entityref) : false;
}
/**\brief Return the associated model entities as a set of UUIDs.
......@@ -389,13 +389,13 @@ bool Attribute::isEntityAssociated(const smtk::model::EntityRef& entityref) cons
smtk::common::UUIDs Attribute::associatedModelEntityIds() const
{
smtk::common::UUIDs result;
if (!this->m_associations)
if (!m_associations)
{
return result;
}
smtk::model::EntityRefArray::const_iterator it;
for (it = this->m_associations->begin(); it != this->m_associations->end(); ++it)
for (it = m_associations->begin(); it != m_associations->end(); ++it)
{
result.insert(it->entity());
}
......@@ -443,7 +443,7 @@ bool Attribute::associateEntity(const smtk::model::EntityRef& entityRef)
if (res)
return res;
res = (this->m_associations) ? this->m_associations->appendValue(entityRef) : false;
res = (m_associations) ? m_associations->appendValue(entityRef) : false;
if (!res)
return res;
......@@ -467,15 +467,15 @@ bool Attribute::associateEntity(const smtk::model::EntityRef& entityRef)
*/
void Attribute::disassociateEntity(const smtk::common::UUID& entity, bool reverse)
{
if (!this->m_associations)
if (!m_associations)
{
return;
}
std::ptrdiff_t idx = this->m_associations->find(entity);
std::ptrdiff_t idx = m_associations->find(entity);
if (idx >= 0)
{
this->m_associations->removeValue(idx);
m_associations->removeValue(idx);
if (reverse)
{
smtk::model::ManagerPtr modelMgr = this->modelManager();
......@@ -492,15 +492,15 @@ void Attribute::disassociateEntity(const smtk::common::UUID& entity, bool revers
*/
void Attribute::disassociateEntity(const smtk::model::EntityRef& entity, bool reverse)
{
if (!this->m_associations)
if (!m_associations)
{
return;
}
std::ptrdiff_t idx = this->m_associations->find(entity);
std::ptrdiff_t idx = m_associations->find(entity);
if (idx >= 0)
{
this->m_associations->removeValue(idx);
m_associations->removeValue(idx);
if (reverse)
{
smtk::model::EntityRef mutableEntity(entity);
......@@ -517,7 +517,7 @@ void Attribute::disassociateEntity(const smtk::model::EntityRef& entity, bool re
*/
smtk::attribute::ItemPtr Attribute::find(const std::string& inName, SearchStyle style)
{
int i = this->m_definition->findItemPosition(inName);
int i = m_definition->findItemPosition(inName);
if (i < 0 && style != NO_CHILDREN)
{ // try to find child items that match the name and type.
std::size_t numItems = this->numberOfItems();
......@@ -532,13 +532,13 @@ smtk::attribute::ItemPtr Attribute::find(const std::string& inName, SearchStyle
}
i = -1; // Nothing found.
}
assert(i < 0 || this->m_items.size() > static_cast<std::size_t>(i));
return (i < 0) ? smtk::attribute::ItemPtr() : this->m_items[static_cast<std::size_t>(i)];
assert(i < 0 || m_items.size() > static_cast<std::size_t>(i));
return (i < 0) ? smtk::attribute::ItemPtr() : m_items[static_cast<std::size_t>(i)];
}
smtk::attribute::ConstItemPtr Attribute::find(const std::string& inName, SearchStyle style) const
{
int i = this->m_definition->findItemPosition(inName);
int i = m_definition->findItemPosition(inName);
if (i < 0 && style != NO_CHILDREN)
{ // try to find child items that match the name and type.
std::size_t numItems = this->numberOfItems();
......@@ -553,9 +553,9 @@ smtk::attribute::ConstItemPtr Attribute::find(const std::string& inName, SearchS
}
i = -1; // Nothing found.
}
assert(i < 0 || this->m_items.size() > static_cast<std::size_t>(i));
assert(i < 0 || m_items.size() > static_cast<std::size_t>(i));
return (i < 0) ? smtk::attribute::ConstItemPtr()
: smtk::const_pointer_cast<const Item>(this->m_items[static_cast<std::size_t>(i)]);
: smtk::const_pointer_cast<const Item>(m_items[static_cast<std::size_t>(i)]);
}
smtk::attribute::IntItemPtr Attribute::findInt(const std::string& nameStr)
......
This diff is collapsed.
......@@ -113,13 +113,13 @@ public:
bool rename(AttributePtr att, const std::string& newName);
bool defineAnalysis(const std::string& analysisName, const std::set<std::string>& categories);
std::size_t numberOfAnalyses() const { return this->m_analyses.size(); }
std::size_t numberOfAnalyses() const { return m_analyses.size(); }
std::set<std::string> analysisCategories(const std::string& analysisType) const;
const std::map<std::string, std::set<std::string> >& analyses() const { return this->m_analyses; }
const std::map<std::string, std::set<std::string> >& analyses() const { return m_analyses; }
std::size_t numberOfAdvanceLevels() const { return this->m_advLevels.size(); }
std::size_t numberOfAdvanceLevels() const { return m_advLevels.size(); }
void addAdvanceLevel(int level, std::string label, const double* l_color = 0);
const std::map<int, std::string>& advanceLevels() const { return this->m_advLevels; }
const std::map<int, std::string>& advanceLevels() const { return m_advLevels; }
// the color is expected in the format of double[4] - rgba
const double* advanceLevelColor(int level) const;
void setAdvanceLevelColor(int level, const double* l_color);
......@@ -132,20 +132,20 @@ public:
std::string createUniqueName(const std::string& type) const;
void updateCategories();
std::size_t numberOfCategories() const { return this->m_categories.size(); }
const std::set<std::string>& categories() const { return this->m_categories; }
std::size_t numberOfCategories() const { return m_categories.size(); }
const std::set<std::string>& categories() const { return m_categories; }
void addView(smtk::view::ViewPtr);
smtk::view::ViewPtr findView(const std::string& name) const;
smtk::view::ViewPtr findViewByType(const std::string& vtype) const;
smtk::view::ViewPtr findTopLevelView() const;
std::vector<smtk::view::ViewPtr> findTopLevelViews() const;
const std::map<std::string, smtk::view::ViewPtr>& views() const { return this->m_views; }
const std::map<std::string, smtk::view::ViewPtr>& views() const { return m_views; }
smtk::model::ManagerPtr refModelManager() const { return this->m_refModelMgr.lock(); }
smtk::model::ManagerPtr refModelManager() const { return m_refModelMgr.lock(); }
void setRefModelManager(smtk::model::ManagerPtr refModelMgr);
bool hasAttributes() { return this->m_attributes.size() > 0; }
bool hasAttributes() { return m_attributes.size() > 0; }
// When a definition's items has changed use this method to update derived def
// item offsets which is used by the find item method
......@@ -197,30 +197,30 @@ private:
inline smtk::view::ViewPtr Collection::findView(const std::string& name) const
{
std::map<std::string, smtk::view::ViewPtr>::const_iterator it;
it = this->m_views.find(name);
return (it == this->m_views.end()) ? smtk::view::ViewPtr() : it->second;
it = m_views.find(name);
return (it == m_views.end()) ? smtk::view::ViewPtr() : it->second;
}
inline smtk::attribute::AttributePtr Collection::findAttribute(const std::string& name) const
{
std::map<std::string, AttributePtr>::const_iterator it;
it = this->m_attributes.find(name);
return (it == this->m_attributes.end()) ? smtk::attribute::AttributePtr() : it->second;
it = m_attributes.find(name);
return (it == m_attributes.end()) ? smtk::attribute::AttributePtr() : it->second;
}
inline smtk::attribute::AttributePtr Collection::findAttribute(
const smtk::common::UUID& attId) const
{
std::map<smtk::common::UUID, AttributePtr>::const_iterator it;
it = this->m_attributeIdMap.find(attId);
return (it == this->m_attributeIdMap.end()) ? smtk::attribute::AttributePtr() : it->second;
it = m_attributeIdMap.find(attId);
return (it == m_attributeIdMap.end()) ? smtk::attribute::AttributePtr() : it->second;
}
inline smtk::attribute::DefinitionPtr Collection::findDefinition(const std::string& typeName) const
{
std::map<std::string, smtk::attribute::DefinitionPtr>::const_iterator it;
it = this->m_definitions.find(typeName);
return (it == this->m_definitions.end()) ? smtk::attribute::DefinitionPtr() : it->second;
it = m_definitions.find(typeName);
return (it == m_definitions.end()) ? smtk::attribute::DefinitionPtr() : it->second;
}
inline void Collection::findDefinitionAttributes(
......@@ -228,8 +228,8 @@ inline void Collection::findDefinitionAttributes(
{
result.clear();
std::map<std::string, std::set<smtk::attribute::AttributePtr> >::const_iterator it;
it = this->m_attributeClusters.find(typeName);
if (it != this->m_attributeClusters.end())
it = m_attributeClusters.find(typeName);
if (it != m_attributeClusters.end())
{
result.insert(result.end(), it->second.begin(), it->second.end());
}
......@@ -257,8 +257,8 @@ inline std::vector<smtk::attribute::AttributePtr> Collection::findAttributes(
inline std::set<std::string> Collection::analysisCategories(const std::string& analysisType) const
{
std::map<std::string, std::set<std::string> >::const_iterator it;
it = this->m_analyses.find(analysisType);
if (it != this->m_analyses.end())
it = m_analyses.find(analysisType);
if (it != m_analyses.end())
{
return it->second;
}
......@@ -269,13 +269,13 @@ inline bool Collection::defineAnalysis(
const std::string& analysisName, const std::set<std::string>& categoriesIn)
{
std::map<std::string, std::set<std::string> >::const_iterator it;
it = this->m_analyses.find(analysisName);
if (it != this->m_analyses.end())
it = m_analyses.find(analysisName);
if (it != m_analyses.end())
{
// it already exists
return false;
}
this->m_analyses[analysisName] = categoriesIn;
m_analyses[analysisName] = categoriesIn;
return true;
}
}
......
......@@ -44,7 +44,7 @@ bool DateTimeItem::isValid() const
{
return true;
}
for (auto it = this->m_isSet.begin(); it != this->m_isSet.end(); ++it)
for (auto it = m_isSet.begin(); it != m_isSet.end(); ++it)
{
if (!(*it))
{
......@@ -64,13 +64,13 @@ bool DateTimeItem::setNumberOfValues(std::size_t newSize)
ConstDateTimeItemDefinitionPtr def = this->itemDefinition();
if (def->hasDefault())
{
this->m_values.resize(newSize, def->defaultValue());
this->m_isSet.resize(newSize, true);
m_values.resize(newSize, def->defaultValue());
m_isSet.resize(newSize, true);
}
else
{
this->m_values.resize(newSize);
this->m_isSet.resize(newSize, false);
m_values.resize(newSize);
m_isSet.resize(newSize, false);
}
return true;
}
......@@ -90,10 +90,10 @@ bool DateTimeItem::setValue(size_t element, const ::smtk::common::DateTimeZonePa
ConstDateTimeItemDefinitionPtr def = this->itemDefinition();
if (def->isValueValid(value))
{
assert(this->m_values.size() > element);
this->m_values[element] = value;
assert(this->m_isSet.size() > element);
this->m_isSet[element] = true;
assert(m_values.size() > element);
m_values[element] = value;
assert(m_isSet.size() > element);
m_isSet[element] = true;
return true;
}
return false;
......@@ -101,20 +101,20 @@ bool DateTimeItem::setValue(size_t element, const ::smtk::common::DateTimeZonePa
void DateTimeItem::reset()
{
this->m_isSet.clear();
this->m_values.clear();
m_isSet.clear();
m_values.clear();
ConstDateTimeItemDefinitionPtr dtDef = itemDefinition();
std::size_t numValues = dtDef->numberOfRequiredValues();
if (dtDef->hasDefault())
{
this->m_isSet.resize(numValues, true);
this->m_values.resize(numValues, dtDef->defaultValue());
m_isSet.resize(numValues, true);
m_values.resize(numValues, dtDef->defaultValue());
}
else
{
this->m_isSet.resize(numValues, false);
this->m_values.resize(numValues);
m_isSet.resize(numValues, false);
m_values.resize(numValues);
}
}
......@@ -133,15 +133,15 @@ bool DateTimeItem::setToDefault(std::size_t element)
bool DateTimeItem::isUsingDefault(std::size_t element) const
{
assert(this->m_isSet.size() > element);
assert(m_isSet.size() > element);
ConstDateTimeItemDefinitionPtr def = itemDefinition();
if (!def->hasDefault() || (!this->m_isSet[element]))
if (!def->hasDefault() || (!m_isSet[element]))
{
return false;
}
sc::DateTimeZonePair defaultVal = def->defaultValue();
return this->m_values[element] == defaultVal;
return m_values[element] == defaultVal;
}
bool DateTimeItem::isUsingDefault() const
......@@ -156,7 +156,7 @@ bool DateTimeItem::isUsingDefault() const
sc::DateTimeZonePair defaultVal = def->defaultValue();
for (std::size_t i = 0; i < numValues; ++i)
{
if (!this->m_isSet[i] || !(this->m_values[i] == defaultVal))
if (!m_isSet[i] || !(m_values[i] == defaultVal))
{
return false;
}
......@@ -204,15 +204,15 @@ bool DateTimeItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr def)
{
if (dtDef->hasDefault())
{
this->m_isSet.resize(numValues, true);
this->m_values.resize(numValues, dtDef->defaultValue());
m_isSet.resize(numValues, true);
m_values.resize(numValues, dtDef->defaultValue());
}
else
{
this->m_isSet.clear();
this->m_isSet.resize(numValues, false);
this->m_values.clear();
this->m_values.resize(numValues);
m_isSet.clear();
m_isSet.resize(numValues, false);
m_values.clear();
m_values.resize(numValues);
}
}
......
......@@ -35,12 +35,12 @@ public:
Item::Type type() const override;
bool isValid() const override;
std::size_t numberOfValues() const { return this->m_values.size(); }
std::size_t numberOfValues() const { return m_values.size(); }
bool setNumberOfValues(std::size_t newSize);
std::size_t numberOfRequiredValues() const;
::smtk::common::DateTimeZonePair value(std::size_t element = 0) const
{
return this->m_values[element];
return m_values[element];
}
bool setValue(const ::smtk::common::DateTimeZonePair& val) { return this->setValue(0, val); }
bool setValue(std::size_t element, const ::smtk::common::DateTimeZonePair& val);
......@@ -50,8 +50,8 @@ public:
virtual bool isUsingDefault(std::size_t elementIndex) const;
// This method tests all of the values of the items w/r the default value
virtual bool isUsingDefault() const;
virtual bool isSet(std::size_t element = 0) const { return this->m_isSet[element]; }
virtual void unset(std::size_t element = 0) { this->m_isSet[element] = false; }
virtual bool isSet(std::size_t element = 0) const { return m_isSet[element]; }
virtual void unset(std::size_t element = 0) { m_isSet[element] = false; }
// Assigns this item to be equivalent to another. Options are processed by derived item classes.
// The options are defined in Item.h. Returns true if success and false if a problem occured.
......
......@@ -34,14 +34,14 @@ Item::Type DateTimeItemDefinition::type() const
bool DateTimeItemDefinition::setDefaultValue(const sc::DateTimeZonePair& value)
{
this->m_defaultValue = value;
this->m_hasDefault = true;
m_defaultValue = value;
m_hasDefault = true;
return true;
}
bool DateTimeItemDefinition::setNumberOfRequiredValues(std::size_t esize)
{
this->m_numberOfRequiredValues = esize;
m_numberOfRequiredValues = esize;
return true;
}
......
......@@ -34,11 +34,11 @@ public:
~DateTimeItemDefinition() override;
Item::Type type() const override;
const ::smtk::common::DateTimeZonePair& defaultValue() const { return this->m_defaultValue; }
const ::smtk::common::DateTimeZonePair& defaultValue() const { return m_defaultValue; }
bool setDefaultValue(const ::smtk::common::DateTimeZonePair& value);
bool hasDefault() const { return this->m_hasDefault; }
bool hasDefault() const { return m_hasDefault; }
std::size_t numberOfRequiredValues() const { return this->m_numberOfRequiredValues; }
std::size_t numberOfRequiredValues() const { return m_numberOfRequiredValues; }
bool setNumberOfRequiredValues(std::size_t esize);
bool isValueValid(const ::smtk::common::DateTimeZonePair& value) const;
......@@ -46,18 +46,18 @@ public:
// Returns or sets the display format to use in UI elements.
// SMTK uses the Qt datetime format expressions documented at
// http://doc.qt.io/qt-4.8/qdatetime.html#toString
void setDisplayFormat(const std::string& format) { this->m_displayFormat = format; }
std::string displayFormat() const { return this->m_displayFormat; }
void setDisplayFormat(const std::string& format) { m_displayFormat = format; }
std::string displayFormat() const { return m_displayFormat; }
// Returns or sets flag indicating if a time zone component can be included
// in the item representation. When set, the UI will include an option to
// specify a TimeZone with the DateTime data.
void setUseTimeZone(bool mode) { this->m_useTimeZone = mode; }
bool useTimeZone() const { return this->m_useTimeZone; }
void setUseTimeZone(bool mode) { m_useTimeZone = mode; }
bool useTimeZone() const { return m_useTimeZone; }
// Returns or sets flag specifying if UI components include
// a pop-up calendar widget.
void setEnableCalendarPopup(bool mode) { this->m_useCalendarPopup = mode; }
void setEnableCalendarPopup(bool mode) { m_useCalendarPopup = mode; }
bool useCalendarPopup() const { return m_useCalendarPopup; }