LCOV - code coverage report
Current view: top level - configmgr/source - config_map.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 5 100.0 %
Date: 2014-11-03 Functions: 18 18 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : #ifndef CONFIG_MAP_HXX
      10             : #define CONFIG_MAP_HXX
      11             : 
      12             : #include <map>
      13             : #include <rtl/ustring.hxx>
      14             : 
      15             : // The realisation here is that while a map is a reasonably compact
      16             : // representation, there is often no need to have it completely
      17             : // sorted, so we can use a fast in-line length comparison as the
      18             : // initial compare, rather than sorting of sub string contents.
      19             : 
      20             : struct LengthContentsCompare
      21             : {
      22   228295937 :     inline bool operator()( const OUString &a, const OUString &b ) const
      23             :     {
      24   228295937 :         if (a.getLength() == b.getLength())
      25   133112884 :             return a < b;
      26             :         else
      27    95183053 :             return a.getLength() < b.getLength();
      28             :     }
      29             : };
      30             : 
      31   154836938 : template< class T > struct config_map : public std::map< OUString, T, LengthContentsCompare > { };
      32             : 
      33             : #endif // CONFIG_MAP_HXX
      34             : 
      35             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10