LCOV - code coverage report
Current view: top level - libreoffice/autodoc/inc/ary - qualiname.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 14 100.0 %
Date: 2012-12-27 Functions: 9 9 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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef ARY_QUALINAME_HXX
      21             : #define ARY_QUALINAME_HXX
      22             : 
      23             : 
      24             : 
      25             : // USED SERVICES
      26             :     // BASE CLASSES
      27             :     // COMPONENTS
      28             :     // PARAMETERS
      29             : #include <cosv/tpl/tpltools.hxx>
      30             : 
      31             : 
      32             : namespace ary
      33             : {
      34             : 
      35             : class QualifiedName
      36             : {
      37             :   public:
      38             :     typedef StringVector::const_iterator  namespace_iterator;
      39             : 
      40             :                         QualifiedName(
      41             :                             uintt               i_nSize = 0);
      42             : 
      43             :     /// @see AssignText()
      44             :                         QualifiedName(
      45             :                             const char *        i_sText,
      46             :                             const char *        i_sSeparator );
      47             :                         ~QualifiedName();
      48             : 
      49       39682 :     QualifiedName &     operator+=(
      50             :                             const String &      i_sNamespaceName )
      51       39682 :                                                 { if (i_sNamespaceName.length() > 0)
      52       39682 :                                                         aNamespace.push_back(i_sNamespaceName);
      53       39682 :                                                   return *this; }
      54             :     /// @precond i_nIndex < NamespaceDepth().
      55             :     String &            operator[](
      56             :                             uintt               i_nIndex )
      57             :                                                 { csv_assert(i_nIndex < aNamespace.size());
      58             :                                                   return aNamespace[i_nIndex]; }
      59        1993 :     void                Init(
      60             :                             bool                i_bAbsolute )
      61        1993 :                                                 { Empty(); bIsAbsolute = i_bAbsolute; }
      62             :     /** Reads a qualified name from a string.
      63             :         If the last two charcters are "()", the inquiry IsFunction() will return
      64             :         true.
      65             :     */
      66             :     void                AssignText(
      67             :                             const char *        i_sText,
      68             :                             const char *        i_sSeparator );
      69       27542 :     void                SetLocalName(
      70             :                             const String &      i_sLocalName )
      71       27542 :                                                 { sLocalName = i_sLocalName; }
      72       29479 :     void                Empty()                 { csv::erase_container(aNamespace); sLocalName.clear(); bIsAbsolute = false; }
      73             : 
      74       40272 :     const String &      LocalName() const       { return sLocalName; }
      75        9853 :     namespace_iterator  first_namespace() const { return aNamespace.begin(); }
      76       49539 :     namespace_iterator  end_namespace() const   { return aNamespace.end(); }
      77       12729 :     uintt               NamespaceDepth() const  { return aNamespace.size(); }
      78             : 
      79       12729 :     bool                IsAbsolute() const      { return bIsAbsolute; }
      80             :     bool                IsQualified() const     { return aNamespace.size() > 0; }
      81             :     bool                IsFunction() const      { return bIsFunction; }
      82             : 
      83             :   private:
      84             :     // DATA
      85             :     StringVector        aNamespace;
      86             :     String              sLocalName;
      87             :     bool                bIsAbsolute;            /// true := beginning with "::".
      88             :     bool                bIsFunction;            /// true := ending with "()"
      89             : };
      90             : 
      91             : 
      92             : 
      93             : 
      94             : }   // namespace ary
      95             : #endif
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10