SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
smtk::attribute::FileItemDefinition Class Reference
Inheritance diagram for smtk::attribute::FileItemDefinition:
[legend]
Collaboration diagram for smtk::attribute::FileItemDefinition:
[legend]

Public Member Functions

 smtkTypeMacro (smtk::attribute::FileItemDefinition)
 
Item::Type type () const override
 
bool isValueValid (const std::string &val) const override
 
int filterId (const std::string &val) const
 return the index of the filter that accepts val, or -1 if the value is invalid
 
smtk::attribute::ItemPtr buildItem (Attribute *owningAttribute, int itemPosition) const override
 
smtk::attribute::ItemPtr buildItem (Item *owningItem, int position, int subGroupPosition) const override
 
const std::string & getFileFilters () const
 A string describing file filters in the Qt format. More...
 
void setFileFilters (const std::string &filters)
 
std::string getSummarizedFileFilters () const
 The same as getFileFilters() but with an "All supported types" as the first entry. More...
 
smtk::attribute::ItemDefinitionPtr createCopy (smtk::attribute::ItemDefinition::CopyInfo &info) const override
 
- Public Member Functions inherited from smtk::attribute::FileSystemItemDefinition
 smtkTypeMacro (smtk::attribute::FileSystemItemDefinition)
 
Item::Type type () const override
 
bool isExtensible () const
 
void setIsExtensible (bool mode)
 
std::size_t numberOfRequiredValues () const
 
bool setNumberOfRequiredValues (std::size_t esize)
 
std::size_t maxNumberOfValues () const
 
bool setMaxNumberOfValues (std::size_t esize)
 
bool hasValueLabels () const
 
void setValueLabel (std::size_t element, const std::string &elabel)
 
void setCommonValueLabel (const std::string &elabel)
 
bool usingCommonLabel () const
 
std::string valueLabel (std::size_t element) const
 
bool shouldExist () const
 
void setShouldExist (bool val)
 
bool shouldBeRelative () const
 
void setShouldBeRelative (bool val)
 
std::string defaultValue () const
 
void setDefaultValue (const std::string &val)
 
void unsetDefaultValue ()
 
bool hasDefault () const
 
- Public Member Functions inherited from smtk::attribute::ItemDefinition
 smtkTypeMacroBase (smtk::attribute::ItemDefinition)
 
const std::string & name () const
 
const std::string & label () const
 
void setLabel (const std::string &newLabel)
 
int version () const
 
void setVersion (int myVersion)
 
bool isOptional () const
 
void setIsOptional (bool isOptionalValue)
 
bool isEnabledByDefault () const
 
void setIsEnabledByDefault (bool isEnabledByDefaultValue)
 
const smtk::attribute::Categoriescategories () const
 Returns the categories (both explicitly assigned and inherited) associated to the Item Definition. More...
 
smtk::attribute::Categories::ExpressionlocalCategories ()
 Returns the categories::Expression explicitly assigned to the Items Definition.
 
const smtk::attribute::Categories::ExpressionlocalCategories () const
 
void setLocalCategories (const smtk::attribute::Categories::Expression &catExp)
 Sets the local categories. More...
 
unsigned int advanceLevel (int mode=0) const
 
unsigned int localAdvanceLevel (int mode=0) const
 
void setLocalAdvanceLevel (int mode, unsigned int level)
 
void setLocalAdvanceLevel (unsigned int level)
 
void unsetLocalAdvanceLevel (int mode=0)
 
bool hasLocalAdvanceLevelInfo (int mode=0) const
 
const std::string & detailedDescription () const
 
void setDetailedDescription (const std::string &text)
 
const std::string & briefDescription () const
 
void setBriefDescription (const std::string &text)
 
const Tags & tags () const
 return the smtk::attribute::Tags associated with the Definition
 
const shared_ptr< units::System > & unitsSystem () const
 Return the unitsSystem of the Definition.
 
Categories::CombinationMode categoryInheritanceMode () const
 Determines how the Definition should combine its local category Set with the category constraints being inherited from it's owning Attribute or Item Definition.
 
void setCategoryInheritanceMode (Categories::CombinationMode mode)
 Determines how the Definition should combine its local category Set with the category constraints being inherited from it's owning Attribute or Item Definition.
 
const Tagtag (const std::string &name) const
 Return a pointer to a smtk::attribute::Tag with a given name. If the Tag does not exist, return a null pointer.
 
Tagtag (const std::string &name)
 Return a pointer to a smtk::attribute::Tag with a given name. If the Tag does not exist, return a null pointer.
 
bool addTag (const Tag &tag)
 Add/Remove a smtk::attribute::Tag from a Definition.
 
bool removeTag (const std::string &name)
 Add/Remove a smtk::attribute::Tag from a Definition.
 

Static Public Member Functions

static smtk::attribute::FileItemDefinitionPtr New (const std::string &myName)
 
static std::string aggregateFileFilters (const std::string &)
 Combine individual file filters into a single filter entry. More...
 
static std::string aggregateFileFilters (const std::string &, int &)
 

Protected Member Functions

 FileItemDefinition (const std::string &myName)
 
- Protected Member Functions inherited from smtk::attribute::FileSystemItemDefinition
 FileSystemItemDefinition (const std::string &myName)
 
- Protected Member Functions inherited from smtk::attribute::ItemDefinition
 ItemDefinition (const std::string &myname)
 
void copyTo (ItemDefinitionPtr def) const
 
virtual void applyCategories (const smtk::attribute::Categories::Stack &inheritedFromParent, smtk::attribute::Categories &inheritedToParent)
 
virtual void applyAdvanceLevels (const unsigned int &readLevelFromParent, const unsigned int &writeLevelFromParent)
 
virtual void setUnitsSystem (const shared_ptr< units::System > &unitsSystem)
 Set the unitsSystem of the Definition. More...
 

Protected Attributes

std::string m_fileFilters
 
- Protected Attributes inherited from smtk::attribute::FileSystemItemDefinition
bool m_shouldExist = false
 
bool m_shouldBeRelative = false
 
bool m_useCommonLabel = false
 
bool m_isExtensible = false
 
bool m_hasDefault = false
 
std::string m_defaultValue
 
std::vector< std::string > m_valueLabels
 
std::size_t m_numberOfRequiredValues = 1
 
std::size_t m_maxNumberOfValues = 0
 
- Protected Attributes inherited from smtk::attribute::ItemDefinition
int m_version
 
bool m_isOptional
 
bool m_isEnabledByDefault
 
std::string m_label
 
attribute::Categories::Expression m_localCategories
 
attribute::Categories m_categories
 
std::string m_detailedDescription
 
std::string m_briefDescription
 
bool m_hasLocalAdvanceLevelInfo [2]
 
unsigned int m_localAdvanceLevel [2]
 
unsigned int m_advanceLevel [2]
 
attribute::Tags m_tags
 
Categories::CombinationMode m_combinationMode
 
std::shared_ptr< units::System > m_unitsSystem
 

Member Function Documentation

◆ aggregateFileFilters()

std::string FileItemDefinition::aggregateFileFilters ( const std::string &  filtersStr)
static

Combine individual file filters into a single filter entry.

For example: "Ext1 (*.ex1);;Ext2 or 3 (*.ex2 *.ex3)" -> "(*.ex1 *.ex2 *.ex3)" "Ext1 (*.ex1);;Ext2 or 3 (*.ex2 *.ex3);;All (*.*)" -> "(*.*)"

The variant which accepts a reference to an integer returns the number of file extensions found (or 0 if *.* is present).

◆ getFileFilters()

const std::string& smtk::attribute::FileItemDefinition::getFileFilters ( ) const
inline

A string describing file filters in the Qt format.

For example: "Ext1 (*.ex1);;Ext2 or 3 (*.ex2 *.ex3);;All (*.*)"

◆ getSummarizedFileFilters()

std::string FileItemDefinition::getSummarizedFileFilters ( ) const

The same as getFileFilters() but with an "All supported types" as the first entry.

This is useful on many platforms as otherwise users must select a file type before being shown available files of that type.

Example: If the file filters are set to Ext1 (*.ex1);;Ext2 (*.ex2), then this method returns All supported types (*.ex1 *.ex2);;Ext1 (*.ex1);;Ext2( *.ex2).

If getFileFilters() returns an empty string, then so does this method.


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