mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: multi-parameter IOobject::scopedName
This commit is contained in:
committed by
Andrew Heather
parent
722c528316
commit
1ddcad820f
@ -307,6 +307,15 @@ public:
|
||||
const word& name
|
||||
);
|
||||
|
||||
//- Create scope:name1:name2 or scope_name1_name2 string
|
||||
// An empty scope is ignored.
|
||||
static inline word scopedName
|
||||
(
|
||||
const std::string& scope,
|
||||
const word& name1,
|
||||
const word& name2
|
||||
);
|
||||
|
||||
//- Return the IOobject, but also consider an alternative file name.
|
||||
//
|
||||
// \param io The expected IOobject to use
|
||||
@ -341,7 +350,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from name, instance, registry, io options
|
||||
// (default: NO_READ, NO_WRITE, register, non-global)
|
||||
// (default: NO_READ, NO_WRITE, REGISTER, non-global)
|
||||
IOobject
|
||||
(
|
||||
const word& name,
|
||||
@ -351,7 +360,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from name, instance, local, registry, io options
|
||||
// (default: NO_READ, NO_WRITE, register, non-global)
|
||||
// (default: NO_READ, NO_WRITE, REGISTER, non-global)
|
||||
IOobject
|
||||
(
|
||||
const word& name,
|
||||
@ -362,7 +371,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from path, registry, io options.
|
||||
// (default: NO_READ, NO_WRITE, register, non-global)
|
||||
// (default: NO_READ, NO_WRITE, REGISTER, non-global)
|
||||
//
|
||||
// Uses fileNameComponents() to split path into components.
|
||||
// A path that starts with a '/' is regarded as a file system path.
|
||||
|
||||
@ -54,7 +54,40 @@ inline Foam::word Foam::IOobject::scopedName
|
||||
return name;
|
||||
}
|
||||
|
||||
return scope + (IOobject::scopeSeparator + name);
|
||||
word output;
|
||||
output.reserve(scope.size() + name.size() + 1);
|
||||
|
||||
output += scope;
|
||||
output += IOobject::scopeSeparator;
|
||||
output += name;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::word Foam::IOobject::scopedName
|
||||
(
|
||||
const std::string& scope,
|
||||
const word& name1,
|
||||
const word& name2
|
||||
)
|
||||
{
|
||||
if (scope.empty())
|
||||
{
|
||||
return IOobject::scopedName(name1, name2);
|
||||
}
|
||||
|
||||
word output;
|
||||
output.reserve(scope.size() + name1.size() + name2.size() + 2);
|
||||
|
||||
output += scope;
|
||||
output += IOobject::scopeSeparator;
|
||||
output += name1;
|
||||
if (!name2.empty())
|
||||
{
|
||||
output += IOobject::scopeSeparator;
|
||||
output += name2;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user