mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
IOobject: Add support for group name
.group() returns the group name of the object otherwise null groupName(name, group) returns the constructed group name (currently name.group)
This commit is contained in:
@ -243,6 +243,21 @@ const Foam::fileName& Foam::IOobject::caseName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::word Foam::IOobject::group() const
|
||||||
|
{
|
||||||
|
word::size_type i = name_.find_last_of('.');
|
||||||
|
|
||||||
|
if (i == word::npos || i == 0)
|
||||||
|
{
|
||||||
|
return word::null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return name_.substr(i+1, word::npos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::fileName& Foam::IOobject::rootPath() const
|
const Foam::fileName& Foam::IOobject::rootPath() const
|
||||||
{
|
{
|
||||||
return time().rootPath();
|
return time().rootPath();
|
||||||
|
|||||||
@ -154,6 +154,7 @@ private:
|
|||||||
//- IOobject state
|
//- IOobject state
|
||||||
objectState objState_;
|
objectState objState_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
@ -187,6 +188,9 @@ public:
|
|||||||
word& name
|
word& name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
template<class Name>
|
||||||
|
static inline word groupName(Name name, const word& group);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -313,6 +317,9 @@ public:
|
|||||||
|
|
||||||
// Path components
|
// Path components
|
||||||
|
|
||||||
|
//- Return group (extension part of name)
|
||||||
|
word group() const;
|
||||||
|
|
||||||
const fileName& rootPath() const;
|
const fileName& rootPath() const;
|
||||||
|
|
||||||
const fileName& caseName() const;
|
const fileName& caseName() const;
|
||||||
|
|||||||
@ -27,6 +27,20 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Name>
|
||||||
|
inline Foam::word Foam::IOobject::groupName(Name name, const word& group)
|
||||||
|
{
|
||||||
|
if (group != word::null)
|
||||||
|
{
|
||||||
|
return name + ('.' + group);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Stream>
|
template<class Stream>
|
||||||
inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user