[#BloombergLP-bsls-BslSourceNameParserUtil-getComponentName] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/BslSourceNameParserUtil.adoc[BslSourceNameParserUtil]::getComponentName :relfileprefix: ../../../ :mrdocs: 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. == 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 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. [.small]#Created with https://www.mrdocs.com[MrDocs]#