summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-16 08:54:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-16 09:04:10 +0100
commit9f3b5b99e1595a3011ced4828fc7645d0d5b4d30 (patch)
tree12d4426ed8e462d595bbbf83135debaa4a687497 /tools
parent13023291d1541cdfc6fa0a00706c149f0f9b2e26 (diff)
ByteString->rtl::OString
Diffstat (limited to 'tools')
-rw-r--r--tools/Executable_rscdep.mk3
-rw-r--r--tools/StaticLibrary_toolshelpers.mk5
-rw-r--r--tools/bootstrp/cppdep.cxx53
-rw-r--r--tools/bootstrp/cppdep.hxx2
4 files changed, 36 insertions, 27 deletions
diff --git a/tools/Executable_rscdep.mk b/tools/Executable_rscdep.mk
index ba3cef72cd5b..61462c64505d 100644
--- a/tools/Executable_rscdep.mk
+++ b/tools/Executable_rscdep.mk
@@ -40,8 +40,9 @@ $(eval $(call gb_Executable_add_defs,rscdep,\
))
$(eval $(call gb_Executable_add_linked_libs,rscdep,\
- sal \
tl \
+ comphelper \
+ sal \
$(gb_STDLIBS) \
))
diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk
index 7ef012377c49..6c6b9ea2f4b9 100644
--- a/tools/StaticLibrary_toolshelpers.mk
+++ b/tools/StaticLibrary_toolshelpers.mk
@@ -35,6 +35,11 @@ $(eval $(call gb_StaticLibrary_set_include,toolshelpers,\
-I$(realpath $(SRCDIR)/tools/bootstrp) \
))
+$(eval $(call gb_StaticLibrary_add_api,toolshelpers,\
+ udkapi \
+ offapi \
+))
+
$(eval $(call gb_StaticLibrary_add_cxxflags,toolshelpers,\
-D_TOOLS_STRINGLIST \
))
diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx
index b2d6cadb5a08..e291777e89f0 100644
--- a/tools/bootstrp/cppdep.cxx
+++ b/tools/bootstrp/cppdep.cxx
@@ -31,11 +31,12 @@
#include <stdio.h>
#include <string.h>
-
#include <unistd.h>
#include <sys/stat.h>
#include <tools/stream.hxx>
+#include <rtl/strbuf.hxx>
+#include <comphelper/string.hxx>
#include "cppdep.hxx"
CppDep::CppDep( ByteString aFileName )
@@ -189,49 +190,51 @@ ByteString CppDep::Exists( ByteString aFileName )
return aString;
}
-ByteString CppDep::IsIncludeStatement( ByteString aLine )
+rtl::OString CppDep::IsIncludeStatement(rtl::OString aLine)
{
- ByteString aRetStr;
- if ( aLine.Search("/*",0) != STRING_NOTFOUND )
+ sal_Int32 nIndex;
+
+ nIndex = aLine.indexOf("/*");
+ if ( nIndex != -1 )
{
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "found starting C comment : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "found starting C comment : %s\n", aLine.getStr() );
#endif
- aLine.Erase(aLine.Search("/*",0), aLine.Len() - 1);
+ aLine = aLine.copy(0, nIndex);
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "cleaned string : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
#endif
}
- if ( aLine.Search("//",0) != STRING_NOTFOUND )
+
+ nIndex = aLine.indexOf("//");
+ if ( nIndex != -1 )
{
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "found C++ comment : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "found C++ comment : %s\n", aLine.getStr() );
#endif
- aLine.Erase(aLine.Search("//",0), aLine.Len() - 1);
+ aLine = aLine.copy(0, nIndex);
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "cleaned string : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
#endif
}
// WhiteSpacesfressen
- aLine.EraseAllChars(' ');
- aLine.EraseAllChars('\t');
+ using comphelper::string::replace;
+ aLine = replace(aLine, rtl::OString(' '), rtl::OString());
+ aLine = replace(aLine, rtl::OString('\t'), rtl::OString());
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "now : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "now : %s\n", aLine.getStr() );
#endif
// ist der erste Teil ein #include ?
- ByteString aTmpStr;
- aTmpStr = aLine.Copy( 0, 8 );
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "is include : %s\n", aTmpStr.GetBuffer() );
-#endif
- if ( aTmpStr.Equals("#include") )
+ rtl::OString aRetStr;
+ if (
+ aLine.getLength() >= 10 &&
+ aLine.match(rtl::OString(RTL_CONSTASCII_STRINGPARAM("#include")))
+ )
{
- aLine.Erase( 0, 8 );
- sal_uInt16 nLen = aLine.Len();
- aLine.Erase( nLen-1, 1 );
- aLine.Erase( 0, 1 );
+ //#include<foo> or #include"foo"
+ aLine = aLine.copy(9, aLine.getLength()-10);
#ifdef DEBUG_VERBOSE
- fprintf( stderr, "Gotcha : %s\n", aLine.GetBuffer() );
+ fprintf( stderr, "Gotcha : %s\n", aLine.getStr() );
#endif
aRetStr = aLine;
}
diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx
index d1e4397f0476..2d80074e35a4 100644
--- a/tools/bootstrp/cppdep.hxx
+++ b/tools/bootstrp/cppdep.hxx
@@ -45,7 +45,7 @@ protected:
sal_Bool Search( ByteString aFileName );
ByteString Exists( ByteString aFileName );
- ByteString IsIncludeStatement( ByteString aLine );
+ rtl::OString IsIncludeStatement(rtl::OString aLine);
public:
CppDep( ByteString aFileName );
CppDep();