diff options
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/inc/codemaker/commoncpp.hxx | 12 | ||||
-rw-r--r-- | codemaker/source/commoncpp/commoncpp.cxx | 17 |
2 files changed, 16 insertions, 13 deletions
diff --git a/codemaker/inc/codemaker/commoncpp.hxx b/codemaker/inc/codemaker/commoncpp.hxx index db5c468c6faa..3cfd7133c0f1 100644 --- a/codemaker/inc/codemaker/commoncpp.hxx +++ b/codemaker/inc/codemaker/commoncpp.hxx @@ -24,8 +24,16 @@ namespace codemaker { namespace cpp { -rtl::OString scopedCppName(rtl::OString const & type, bool bNoNameSpace=false, - bool shortname=false); +/** Stick a namespace scope to c++ type + + @param type + Undecorated type + + @param ns_alias + Use common namespace aliases instead of fully specified (nested) + namespace. currently replaces com::sun::star with css. + */ +rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true); rtl::OString translateUnoToCppType( codemaker::UnoType::Sort sort, RTTypeClass typeClass, diff --git a/codemaker/source/commoncpp/commoncpp.cxx b/codemaker/source/commoncpp/commoncpp.cxx index 53cd5dae61ab..989052d67030 100644 --- a/codemaker/source/commoncpp/commoncpp.cxx +++ b/codemaker/source/commoncpp/commoncpp.cxx @@ -37,8 +37,7 @@ namespace codemaker { namespace cpp { -rtl::OString scopedCppName(rtl::OString const & type, bool bNoNameSpace, - bool shortname) +rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias) { char c('/'); sal_Int32 nPos = type.lastIndexOf( c ); @@ -49,8 +48,6 @@ rtl::OString scopedCppName(rtl::OString const & type, bool bNoNameSpace, c = '.'; } - if (bNoNameSpace) - return type.copy(nPos+1); rtl::OStringBuffer tmpBuf(type.getLength()*2); nPos = 0; @@ -60,15 +57,13 @@ rtl::OString scopedCppName(rtl::OString const & type, bool bNoNameSpace, tmpBuf.append(type.getToken(0, c, nPos)); } while( nPos != -1 ); - if (shortname) { - rtl::OString s(tmpBuf.makeStringAndClear()); - if (s.indexOf("::com::sun::star") == 0) - return s.replaceAt(0, 16, "css"); - else - return s; + rtl::OString s(tmpBuf.makeStringAndClear()); + if (ns_alias && s.indexOf("::com::sun::star::") == 0) + { + return s.replaceAt(0, 18, "css::"); // nicer shorthand } - return tmpBuf.makeStringAndClear(); + return s; } |