summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2001-05-10 12:07:49 +0000
committerPhilipp Lohmann <pl@openoffice.org>2001-05-10 12:07:49 +0000
commit2f02e0b70843b881756aa2cc68c19e64b1bef777 (patch)
tree0d43e67e6c51b651202019e4d9660d0259a33077 /idlc
parent2d04e77e8fbfe1d02ce8e095aa6639cedc8ae613 (diff)
osl string api changes
Diffstat (limited to 'idlc')
-rw-r--r--idlc/source/astdeclaration.cxx69
-rw-r--r--idlc/source/astscope.cxx22
-rw-r--r--idlc/source/fehelper.cxx10
-rw-r--r--idlc/source/idlcmain.cxx14
-rw-r--r--idlc/source/idlcproduce.cxx34
-rw-r--r--idlc/source/options.cxx11
-rw-r--r--idlc/source/scanner.ll21
7 files changed, 94 insertions, 87 deletions
diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx
index 913b78ac6ad0..a25c0aa45f87 100644
--- a/idlc/source/astdeclaration.cxx
+++ b/idlc/source/astdeclaration.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astdeclaration.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-04-11 07:24:23 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,20 +75,16 @@ static OString sGlobal("::");
static OString convertName(const OString& name)
{
OStringBuffer nameBuffer(name.getLength()+1);
- sal_Int32 count = name.getTokenCount(':');
- if ( count )
+ sal_Int32 nIndex = 0;
+ do
{
- sal_Int32 offset = (name.indexOf("::") == 0 ? 2 : 0);
- for (sal_Int32 i=offset; i < count; i+=2 )
+ OString token( name.getToken( 0, ':', nIndex ) );
+ if( token.getLength() )
{
nameBuffer.append('/');
- nameBuffer.append(name.getToken(i, ':'));
+ nameBuffer.append( token );
}
- } else
- {
- nameBuffer.append('/');
- nameBuffer.append(name);
- }
+ } while( nIndex != -1 );
return nameBuffer.makeStringAndClear();
}
@@ -138,27 +134,34 @@ AstDeclaration::~AstDeclaration()
void AstDeclaration::setName(const ::rtl::OString& name)
{
- sal_Int32 count = name.getTokenCount(':');
- if ( count > 0 )
- {
- m_localName = name.getToken(count-1, ':');
- m_scopedName = name;
- } else if ( m_pScope )
- {
- m_localName = name;
- AstDeclaration* pDecl = scopeAsDecl(m_pScope);
- if (pDecl)
- {
- m_scopedName = pDecl->getScopedName();
- if (m_scopedName.getLength() > 0)
- m_scopedName += sGlobal;
- m_scopedName += m_localName;
- }
- } else
- {
- m_localName = name;
- m_scopedName = name;
- }
+ m_scopedName = name;
+ sal_Int32 nIndex = name.lastIndexOf( ':' );
+ m_localName = name.copy( nIndex != -1 ? nIndex+1 : 0 );
+
+// Huh ? There is always at least one token
+
+// sal_Int32 count = name.getTokenCount(':');
+
+// if ( count > 0 )
+// {
+// m_localName = name.getToken(count-1, ':');
+// m_scopedName = name;
+// } else if ( m_pScope )
+// {
+// m_localName = name;
+// AstDeclaration* pDecl = scopeAsDecl(m_pScope);
+// if (pDecl)
+// {
+// m_scopedName = pDecl->getScopedName();
+// if (m_scopedName.getLength() > 0)
+// m_scopedName += sGlobal;
+// m_scopedName += m_localName;
+// }
+// } else
+// {
+// m_localName = name;
+// m_scopedName = name;
+// }
m_fullName = convertName(m_scopedName);
}
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index 01f40629a32f..4ea17b1fcd46 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: astscope.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jsc $ $Date: 2001-04-11 07:24:23 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -180,8 +180,8 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName)
// The name does not start with "::"
// Look up in the local scope and start with the first scope
- OString firstScope = scopedName.indexOf(':') > 0 ?
- scopedName.getToken(0, ':') : scopedName;
+ sal_Int32 nIndex = scopedName.indexOf(':');
+ OString firstScope = nIndex > 0 ? scopedName.copy(0, nIndex) : scopedName;
sal_Bool bFindFirstScope = sal_True;
pDecl = lookupByNameLocal(firstScope);
if ( !pDecl )
@@ -212,17 +212,15 @@ AstDeclaration* AstScope::lookupByName(const OString& scopedName)
if ( bFindFirstScope && (firstScope != scopedName) )
{
- sal_Int32 count = scopedName.getTokenCount(':');
- for ( sal_Int32 i = 2; i < count; i += 2 )
+ sal_Int32 nIndex = 1;
+ do
{
pScope = declAsScope(pDecl);
-
- if ( pScope )
- pDecl = pScope->lookupByNameLocal(scopedName.getToken(i, ':'));
-
- if ( !pDecl )
+ if( pScope )
+ pDecl = pScope->lookupByNameLocal(scopedName.getToken(1, ':', nIndex ));
+ if( !pDecl )
return NULL;
- }
+ } while( nIndex != -1 );
}
// if ( !pDecl )
diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx
index be3a2791d070..3b5d301fa4a5 100644
--- a/idlc/source/fehelper.cxx
+++ b/idlc/source/fehelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fehelper.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-04-11 07:24:23 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,9 +84,9 @@ FeDeclarator::~FeDeclarator()
sal_Bool FeDeclarator::checkType(AstDeclaration *type)
{
OString tmp(m_name);
- sal_uInt32 count = 0;
- if ( (count = m_name.getTokenCount(':')) > 0 )
- tmp = m_name.getToken(count-1, ':');
+ sal_Int32 count = m_name.lastIndexOf( ':' );
+ if( count != -1 )
+ tmp = m_name.copy( count+1 );
if (tmp == type->getLocalName())
return sal_False;
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index e54b673091e1..ef4cc1d3a3f0 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idlcmain.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jsc $ $Date: 2001-03-15 12:30:43 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,9 +63,9 @@
#endif
#ifdef SAL_UNX
-sal_Char SEPERATOR = '/';
+sal_Char SEPARATOR = '/';
#else
-sal_Char SEPERATOR = '\\';
+sal_Char SEPARATOR = '\\';
#endif
using namespace ::rtl;
@@ -105,11 +105,11 @@ void SAL_CALL main( int argc, char** argv )
outputName = options.getOption("-O");
sal_Char c = outputName.getStr()[outputName.getLength()-1];
- if ( c != SEPERATOR )
- outputName += OString::valueOf(SEPERATOR);
+ if ( c != SEPARATOR )
+ outputName += OString::valueOf(SEPARATOR);
}
- OString strippedFileName(files[i].copy(files[i].lastIndexOf(SEPERATOR) + 1));
+ OString strippedFileName(files[i].copy(files[i].lastIndexOf(SEPARATOR) + 1));
outputName += strippedFileName.replaceAt(strippedFileName.getLength() -3 , 3, "urd");
removeIfExists(outputName);
} else
diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx
index 57befdea9b48..fe5fcd3f3b6c 100644
--- a/idlc/source/idlcproduce.cxx
+++ b/idlc/source/idlcproduce.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: idlcproduce.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-04-11 07:24:23 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,9 +81,9 @@
#endif
#ifdef SAL_UNX
-extern sal_Char SEPERATOR;
+extern sal_Char SEPARATOR;
#else
-extern sal_Char SEPERATOR;
+extern sal_Char SEPARATOR;
#endif
using namespace ::rtl;
@@ -93,26 +93,24 @@ StringList* pCreatedDirectories = NULL;
static sal_Bool checkOutputPath(const OString& completeName)
{
OStringBuffer buffer(completeName.getLength());
- sal_Int32 count = completeName.getTokenCount(SEPERATOR) - 1;
- sal_Int32 offset=0;
- if ( !count )
+ if ( completeName.indexOf( SEPARATOR ) == -1 )
return sal_True;
- OString token(completeName.getToken(0, SEPERATOR));
+ sal_Int32 nIndex = 0;
+ OString token(completeName.getToken(0, SEPARATOR, nIndex));
const sal_Char* p = token.getStr();
if (strcmp(p, "..") == 0
|| *(p+1) == ':'
|| strcmp(p, ".") == 0)
{
- offset++;
buffer.append(token);
- buffer.append(SEPERATOR);
+ buffer.append(SEPARATOR);
}
- for (sal_Int32 i=offset; i < count; i++)
+ do
{
- buffer.append(completeName.getToken(i, SEPERATOR));
+ buffer.append(completeName.getToken(0, SEPARATOR, nIndex));
if ( buffer.getLength() > 0 )
{
@@ -135,9 +133,9 @@ static sal_Bool checkOutputPath(const OString& completeName)
pCreatedDirectories->push_front(buffer.getStr());
}
}
- if ( i+1 < count )
- buffer.append(SEPERATOR);
- }
+ if ( nIndex != -1 )
+ buffer.append(SEPARATOR);
+ } while( nIndex != -1 );
return sal_True;
}
@@ -186,12 +184,12 @@ sal_Int32 SAL_CALL produceFile(const OString& fileName)
regFileName = pOptions->getOption("-O");
sal_Char c = regFileName.getStr()[regFileName.getLength()-1];
- if ( c != SEPERATOR )
- regFileName += OString::valueOf(SEPERATOR);
+ if ( c != SEPARATOR )
+ regFileName += OString::valueOf(SEPARATOR);
}
OString regTmpName(regFileName);
- OString strippedFileName(fileName.copy(fileName.lastIndexOf(SEPERATOR) + 1));
+ OString strippedFileName(fileName.copy(fileName.lastIndexOf(SEPARATOR) + 1));
regFileName += strippedFileName.replaceAt(strippedFileName.getLength() -3 , 3, "urd");
regTmpName += strippedFileName.replaceAt(strippedFileName.getLength() -3 , 3, "_idlc_");
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index 8b8f89646512..dafb5478abdf 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: options.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jbu $ $Date: 2001-05-09 07:57:56 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -157,10 +157,9 @@ sal_Bool Options::initOptions(int ac, char* av[], sal_Bool bCmdFile)
if ( inc.indexOf(';') > 0 )
{
OString tmp(s);
- sal_Int32 count = tmp.getTokenCount(';');
+ sal_Int32 nIndex = 0;
inc = OString();
- for (sal_Int32 i=0; i < count; i++)
- inc = inc + " -I" + tmp.getToken(i, ';');
+ do inc = inc + "-I" + tmp.getToken( 0, ';', nIndex ); while( nIndex != -1 );
} else
inc = OString("-I") + s;
@@ -264,7 +263,7 @@ sal_Bool Options::initOptions(int ac, char* av[], sal_Bool bCmdFile)
} else
{
OString name(av[i]);
- name = name.toLowerCase();
+ name = name.toAsciiLowerCase();
if ( name.lastIndexOf(".idl") != (name.getLength() - 4) )
{
throw IllegalArgument("'" + OString(av[i]) +
diff --git a/idlc/source/scanner.ll b/idlc/source/scanner.ll
index ece1216c69b8..2e968fe23c68 100644
--- a/idlc/source/scanner.ll
+++ b/idlc/source/scanner.ll
@@ -2,9 +2,9 @@
*
* $RCSfile: scanner.ll,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jsc $ $Date: 2001-03-27 10:53:19 $
+ * last change: $Author: pl $ $Date: 2001-05-10 13:07:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -349,7 +349,7 @@ oneway return IDL_ONEWAY;
}
\:\: {
yylval.strval = yytext;
- return IDL_SCOPESEPERATOR;
+ return IDL_SCOPESEPARATOR;
}
"/*" {
@@ -378,7 +378,10 @@ oneway return IDL_ONEWAY;
<COMMENT>[*]+"/" {
docu = docu.trim();
- idlc()->setLineNumber( beginLine + docu.getTokenCount('\n') - 1);
+ sal_Int32 nIndex = 0;
+ int count = 0;
+ do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 );
+ idlc()->setLineNumber( beginLine + count - 1);
BEGIN( INITIAL );
}
@@ -405,14 +408,20 @@ oneway return IDL_ONEWAY;
<DOCU>"\n"[ \t]*"*/" {
docu = docu.trim();
- idlc()->setLineNumber( beginLine + docu.getTokenCount('\n') - 1);
+ sal_Int32 nIndex = 0;
+ int count = 0;
+ do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 );
+ idlc()->setLineNumber( beginLine + count - 1);
idlc()->setDocumentation(docu);
BEGIN( INITIAL );
}
<DOCU>"*/" {
docu = docu.trim();
- idlc()->setLineNumber( beginLine + docu.getTokenCount('\n') - 1);
+ sal_Int32 nIndex = 0;
+ int count = 0;
+ do { docu.getToken( 0, '\n', nIndex ); count++; } while( nIndex != -1 );
+ idlc()->setLineNumber( beginLine + count - 1);
idlc()->setDocumentation(docu);
BEGIN( INITIAL );
}