summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-04-15 14:57:33 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-04-15 14:57:33 +0000
commit063ace526cce863340145a66f1b921064b53cd0a (patch)
treeea3a6d6e55c479042d8f44e1554925f405c329df
parent37519d18d8c241772dfac5d0597dca787520ead8 (diff)
INTEGRATION: CWS dbgmacros1 (1.2.28); FILE MERGED
2003/04/10 08:33:04 kso 1.2.28.1: #108413# - debug macro unification.
-rw-r--r--shell/source/tools/lngconvex/lngconvex.cxx101
1 files changed, 52 insertions, 49 deletions
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx
index 313e7b7f3e..abdec4eaab 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -11,6 +11,9 @@
#include <iostream>
#include <fstream>
+#if OSL_DEBUG_LEVEL == 0
+#define NDEBUG
+#endif
#include <assert.h>
#include <map>
#include <sstream>
@@ -52,7 +55,7 @@
namespace /* private */
{
-//-------------------------------
+//-------------------------------
/** Various constants
*/
const std::string RC_PLACEHOLDER_LANGUAGE = "%LANGUAGE%";
@@ -92,7 +95,7 @@ void ShowUsage()
//-------------------------------------------
/** Get the directory where the module
- is located as system directory,
+ is located as system directory,
the returned directory has a trailing '\'
*/
@@ -100,10 +103,10 @@ rtl::OUString GetModuleDirectory()
{
rtl::OUString cwd_url;
rtl::OUString module_dir;
-
- if (osl_Process_E_None == osl_getProcessWorkingDir(&cwd_url.pData))
+
+ if (osl_Process_E_None == osl_getProcessWorkingDir(&cwd_url.pData))
osl::FileBase::getSystemPathFromFileURL(cwd_url, module_dir);
-
+
return module_dir;
}
@@ -111,9 +114,9 @@ rtl::OUString GetModuleDirectory()
/** Make the absolute directory of a base and
a relative directory,
if the relative directory is absolute the
- the relative directory will be returned
+ the relative directory will be returned
unchanged.
- Base and relative directory should be
+ Base and relative directory should be
system paths the returned directory is
a system path too
*/
@@ -122,16 +125,16 @@ rtl::OUString GetAbsoluteDirectory(
{
rtl::OUString base_url;
rtl::OUString rel_url;
-
+
osl::FileBase::getFileURLFromSystemPath(BaseDir, base_url);
osl::FileBase::getFileURLFromSystemPath(RelDir, rel_url);
-
+
rtl::OUString abs_url;
osl::FileBase::getAbsoluteFileURL(base_url, rel_url, abs_url);
-
+
rtl::OUString abs_sys_path;
osl::FileBase::getSystemPathFromFileURL(abs_url, abs_sys_path);
-
+
return abs_sys_path;
}
@@ -163,11 +166,11 @@ class StreamExceptionsEnabler
{
public:
explicit StreamExceptionsEnabler(
- std::ios& iostrm,
+ std::ios& iostrm,
std::ios::iostate NewIos = std::ios::failbit | std::ios::badbit) :
m_IoStrm(iostrm),
m_OldIos(m_IoStrm.exceptions())
- {
+ {
m_IoStrm.exceptions(NewIos);
}
@@ -187,7 +190,7 @@ private:
//-----------------------------
/** A line struct (in order to
- define line reading
+ define line reading
operators for file streams)
*/
struct Line
@@ -251,7 +254,7 @@ LineBuffer_t g_resource_template;
*/
class Substitutor
{
-private:
+private:
typedef std::map<std::string, std::string> ReplacementTable_t;
typedef std::map<CountryIdentifier_t, ReplacementTable_t*> CountryReplacementTable_t;
@@ -298,10 +301,10 @@ public:
return m_ActiveCountry;
}
- /** If Text is a placeholder substitute it with
+ /** If Text is a placeholder substitute it with
its substitute else leave it unchanged
*/
- void Substitute(std::string& Text)
+ void Substitute(std::string& Text)
{
ReplacementTable_t* prt = GetReplacementTable(m_ActiveCountry);
assert(prt);
@@ -323,7 +326,7 @@ public:
private:
- /** Return the replacement table for the country id
+ /** Return the replacement table for the country id
create a new one if not already present
*/
ReplacementTable_t* GetReplacementTable(const CountryIdentifier_t& CountryId)
@@ -352,12 +355,12 @@ private:
//-----------------------------------------------------
-/* LangSubLangPair_t contains the Languages and the
+/* LangSubLangPair_t contains the Languages and the
SubLanguage defines as string (see MS Platform SDK
winnt.h), e.g LANG_GERMAN, SUBLANG_GERMAN
CountryLanguageMap_t associates country identifiers
- (the country phone preselection) and the appropriate
+ (the country phone preselection) and the appropriate
LangSubLangPair_t's
*/
typedef std::pair<std::string, std::string> LangSubLangPair_t;
@@ -372,18 +375,18 @@ std::basic_istream<charT,traits>& operator>>(
std::basic_istream<charT,traits>& strm, CountryLanguagePair_t& cl_pair)
{
strm >> cl_pair.first;
- strm >> cl_pair.second.first;
+ strm >> cl_pair.second.first;
strm >> cl_pair.second.second;
-
+
return strm;
}
//--------------------------------
/** Read the country language file
- and add the entries to the
+ and add the entries to the
substitutor
- The format of the country
+ The format of the country
language file is:
Country Identifier LANG_??? SUBLANG_???
@@ -421,9 +424,9 @@ void ReadCtryLngFile(
StreamExceptionsEnabler sexc(is);
try
- {
+ {
while (is >> cl_pair)
- {
+ {
CtryContainer.push_back(cl_pair.first);
substitutor.SetActiveCountry(cl_pair.first);
@@ -434,13 +437,13 @@ void ReadCtryLngFile(
substitutor.AddSubstitution(
RC_PLACEHOLDER_SUBLANGUAGE,
- cl_pair.second.second);
+ cl_pair.second.second);
}
}
catch(const std::ios::failure&)
{
if (!is.eof())
- throw;
+ throw;
}
// sort the country container
@@ -462,20 +465,20 @@ std::string OUStringToWinResourceString(const rtl::OUString& aString)
std::ostringstream oss;
oss << "L\"";
-
+
size_t length = aString.getLength();
const sal_Unicode* pchr = aString.getStr();
for (size_t i = 0; i < length; i++)
oss << "\\x" << std::hex << (int)*pchr++;
-
+
oss << "\"";
return oss.str();
}
//-------------------------------
-/**
+/**
*/
void AddGroupEntriesToSubstitutor(
Config& aConfig, const ByteString& GroupName, Substitutor& Substitutor, CountryIdentifierContainer_t& CtryContainer)
@@ -492,7 +495,7 @@ void AddGroupEntriesToSubstitutor(
ByteString key = aConfig.GetKeyName(i);
bool is_numeric_key = key.IsNumericAscii();
-
+
assert(is_numeric_key);
if (is_numeric_key)
@@ -504,19 +507,19 @@ void AddGroupEntriesToSubstitutor(
Substitutor.SetActiveCountry(country_id);
ByteString key_value = aConfig.ReadKey(i);
-
+
key_value.EraseLeadingAndTrailingChars('\"');
- rtl::OUString key_value_unicode =
+ rtl::OUString key_value_unicode =
rtl::OStringToOUString(key_value, Langcode2TextEncoding(country_id));
-
+
assert(key_value_unicode.getLength());
- Substitutor.AddSubstitution(
- GroupName.GetBuffer(),
+ Substitutor.AddSubstitution(
+ GroupName.GetBuffer(),
OUStringToWinResourceString(key_value_unicode));
}
- }
+ }
}
//-------------------------------
@@ -524,7 +527,7 @@ void AddGroupEntriesToSubstitutor(
*/
void ReadLngFile(
const std::string& FileName, Substitutor& Substitutor, CountryIdentifierContainer_t& CtryContainer)
-{
+{
Config config(
rtl::OStringToOUString(FileName.c_str(), osl_getThreadTextEncoding()).getStr());
@@ -545,7 +548,7 @@ void ReadLngFile(
into a line buffer
*/
void ReadFile(const std::string& FileName, LineBuffer_t& LineBuffer)
-{
+{
std::ifstream file(FileName.c_str());
StreamExceptionsEnabler sexc(file);
@@ -558,7 +561,7 @@ void ReadFile(const std::string& FileName, LineBuffer_t& LineBuffer)
catch(const std::ios::failure&)
{
if (!file.eof())
- throw;
+ throw;
}
}
@@ -568,7 +571,7 @@ void ReadFile(const std::string& FileName, LineBuffer_t& LineBuffer)
file to another one
@throws std::ios::failure
- if a read or write error
+ if a read or write error
occurs
*/
void FileAppendFile(std::ostream& os, std::istream& is)
@@ -588,7 +591,7 @@ void FileAppendFile(std::ostream& os, std::istream& is)
catch(const std::ios::failure&)
{
if (!is.eof())
- throw;
+ throw;
}
}
@@ -633,10 +636,10 @@ void InflateRcTemplateAndAppendToFile(
for (/**/ ;iter != iter_end; ++iter)
{
substitutor.SetActiveCountry(*iter);
-
+
LineBuffer_t::const_iterator rct_iter = RcTemplate.begin();
LineBuffer_t::const_iterator rct_iter_end = RcTemplate.end();
-
+
for (/**/ ;rct_iter != rct_iter_end; ++rct_iter)
{
std::istringstream iss = rct_iter->m_Line;
@@ -650,10 +653,10 @@ void InflateRcTemplateAndAppendToFile(
line += token;
line += " ";
}
-
+
oi = line;
- }
- }
+ }
+ }
}
//--------------------------------
@@ -688,7 +691,7 @@ void MakeUniqueIntersection(
//-------------------------------
-/** Main
+/** Main
The file names provided via
command line should be absolute