ENH: Added dictName() functions to return last cmpt of scoped name

This commit is contained in:
andy
2010-10-11 17:31:01 +01:00
parent 9de20a6654
commit a6134d254a
2 changed files with 25 additions and 2 deletions

View File

@ -111,6 +111,23 @@ public:
{
return name_;
}
//- Return the local dictionary name (final part of scoped name)
const word dictName() const
{
const word scopedName = name_.name();
string::size_type i = scopedName.rfind(':');
if (i == scopedName.npos)
{
return scopedName;
}
else
{
return scopedName.substr(i + 1, scopedName.npos);
}
}
};

View File

@ -106,13 +106,19 @@ public:
// Member functions
//- Return the dictionary name
//- Return the local dictionary name (final part of scoped name)
const word dictName() const
{
return dictionary::dictName();
}
//- Return the dictionary name (scoped, e.g. dictA::dictB::dictC)
const fileName& name() const
{
return dictionary::name();
}
//- Return the dictionary name
//- Return the dictionary name (scoped, e.g. dictA::dictB::dictC)
fileName& name()
{
return dictionary::name();