[#BloombergLP-bsls-BslSourceNameParserUtil-getComponentName] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/BslSourceNameParserUtil.adoc[BslSourceNameParserUtil]::getComponentName :relfileprefix: ../../../ :mrdocs: Parse a Lakos‐style source file name and return its component name. == Synopsis Declared in `<bsls_bslsourcenameparserutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int getComponentName( char const** componentNamePtr, size_t* componentNameLength, char const* sourceName, unsigned int* type_p = 0); ---- == Description 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. == Return Value 0 on success, or a non‐zero value if parsing failed == Parameters [cols="1,4"] |=== | Name| Description | *componentNamePtr* | address of the pointer set to the component name on success | *componentNameLength* | address of the length set to the component name length on success | *sourceName* | Lakos‐style source file name, optionally with a path | *type_p* | optional address of a bit field describing the source type; when non‐null, bits are set according to `SourceTypes` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#