diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-07 12:15:28 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-10-08 15:44:33 -0400 |
commit | f4bda54cdaf13cf96ff7c9327036568825c8c323 (patch) | |
tree | 8fa25fe11fdc329e3a8a9b6a2750b75a7dd63577 /include/svl | |
parent | 6ddcbf4b2fddbb1bad2da05fc6ced1046493d058 (diff) |
Re-implement interning in order to return both string arrays.
One is for the cased string and the other one for the non-cased one.
Change-Id: I798687f2efecaaea73a09e0b3348f85a9d9e8c07
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/sharedstring.hxx | 41 | ||||
-rw-r--r-- | include/svl/sharedstringpool.hxx | 9 |
2 files changed, 45 insertions, 5 deletions
diff --git a/include/svl/sharedstring.hxx b/include/svl/sharedstring.hxx new file mode 100644 index 000000000000..062d0649679c --- /dev/null +++ b/include/svl/sharedstring.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef SVL_SHAREDSTRING_HXX +#define SVL_SHAREDSTRING_HXX + +#include "svl/svldllapi.h" +#include "rtl/ustring.hxx" + +namespace svl { + +class SVL_DLLPUBLIC SharedString +{ + rtl_uString* mpData; + rtl_uString* mpDataIgnoreCase; +public: + SharedString(); + SharedString( rtl_uString* pData, rtl_uString* pDataIgnoreCase ); + SharedString( const SharedString& r ); + ~SharedString(); + + SharedString& operator= ( const SharedString& r ); + + rtl_uString* getData(); + const rtl_uString* getData() const; + + rtl_uString* getDataIgnoreCase(); + const rtl_uString* getDataIgnoreCase() const; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index 6793162059f8..35ce28e6a6ee 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -10,8 +10,7 @@ #ifndef SVL_STRINGPOOL_HXX #define SVL_STRINGPOOL_HXX -#include "svl/svldllapi.h" -#include "rtl/ustring.hxx" +#include "svl/sharedstring.hxx" #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> @@ -29,11 +28,11 @@ class SVL_DLLPUBLIC SharedStringPool { typedef boost::unordered_set<OUString, OUStringHash> StrHashType; typedef std::pair<StrHashType::iterator, bool> InsertResultType; - typedef boost::unordered_map<const rtl_uString*, OUString> StrIdMapType; + typedef boost::unordered_map<const rtl_uString*, OUString> StrStoreType; StrHashType maStrPool; StrHashType maStrPoolUpper; - StrIdMapType maToUpperMap; + StrStoreType maStrStore; const CharClass* mpCharClass; public: @@ -49,7 +48,7 @@ public: * @return a pointer to the string object stored inside the pool, or NULL * if the insertion fails. */ - rtl_uString* intern( const OUString& rStr ); + SharedString intern( const OUString& rStr ); /** * Get a unique ID of string object that's expected to be in the shared |