BDE 4.14.0 Production release
|
#include <bsls_bslsourcenameparserutil.h>
Public Types | |
enum | SourceTypes { k_MASK_KIND = 0x3 , k_MASK_TEST = 0x2 , k_HEADER = 0x0 , k_IMPL = 0x1 , k_TTEST = 0x2 , k_GTEST = 0x3 , k_IS_TEST_XTEMPLATE = 0x4 , k_IS_MULTIFILE_TEST = 0x8 , k_IS_SUBORDINATE_TEST = 0x10 , k_IS_CPP03_GENERATED = 0x20 } |
Static Public Member Functions | |
static int | getComponentName (const char **componentNamePtr, size_t *componentNameLength, const char *sourceName, unsigned *type_p=0) |
static const char * | errorMessage (int errorCode) |
This struct
provides a namespace for static
utility functions that parse source file names (as may be reported by the __FILE__
macro), including Lakos-style component source and test driver names.
|
static |
Return a static, brief English error message that describes the specified negative parsing errorCode
. The behavior is undefined unless errorCode < 0
and was returned by one of the parsing methods (of this utility) that states in its contract to use this method to get the description of an error code.
|
static |
Parse the specified Lakos-style sourceName
source file name with optional path portion to find the component name part. Return zero on success and a non-zero value if parsing failed. In case of success, fill the specified componentNamePtr
with a pointer to the first character, and the specified componentNameLength
with the number of character of the component name found. Optionally specify type_p
. When type_p
is not 0 set the bits of the pointed unsigned
, according to SourceTypes
, that describe the type of the source file that was parsed.
This function does not validate its input, it assumes that it is a valid Lakos-style component source or test driver file name, or one of the special names defined by John Lakos: Large Scale C++ Design (application, adapter, etc). If SourceName
is not as such, the function may return a non-zero error value, or it may report success with its output is unspecified.
Subordinate test component sources are special, as they should not contain code, only their test drivers. The component name reported for subordinate test drivers is the main component name.
Use the errorMessage
function (in this utility) to get a static, brief English textual description of a negative return value.