LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/parser/inc/tokens - tkpcontx.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 2 50.0 %
Date: 2012-12-27 Functions: 1 4 25.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 ADC_TKPCONTX_HXX
      21             : #define ADC_TKPCONTX_HXX
      22             : 
      23             : // USED SERVICES
      24             :     // BASE CLASSES
      25             :     // COMPONENTS
      26             :     // PARAMETERS
      27             : #include <tokens/token.hxx>
      28             : class CharacterSource;
      29             : class TkpNullContext;
      30             : 
      31             : /** @task
      32             :     Specifies a context within which tokens are interpreted in a special
      33             :     way. For example in parsing C++ there could be a context for code,
      34             :     one for comments and a third one for preprocessor statements, because
      35             :     each of these would give the same token different meanings.
      36             : 
      37             :     The three functions
      38             :             ReadCharChain()
      39             :             PassNewToken()
      40             :             FollowUpContext()
      41             :     have to be called in this sequence.
      42             : 
      43             : **/
      44             : class TkpContext
      45             : {
      46             :   public:
      47             :     // LIFECYCLE
      48          40 :     virtual                 ~TkpContext() {}
      49             : 
      50             :     // OPERATIONS
      51             :     /** @descr
      52             :         The functions starts to parse with the CurChar() of io_rText.
      53             :         It leaves io_rText.CurChar() at the first char of the following Token or
      54             :         the following Context.
      55             : 
      56             :         This function returns, when a context has parsed some characterss
      57             :         and completed a token OR left the context.
      58             :         If the token is to be ignored, it is cut from io_rText.
      59             : 
      60             :         If the token is to be parsed further in a different context,
      61             :         it is NOT cut from io_rText.
      62             : 
      63             :         After this function PassNewToken() has to be called.
      64             : 
      65             :         If the function has found a valid and complete token, PassNewToken()
      66             :         passes the parsed token to the internally known receiver and
      67             :         returns true. The token is cut from io_rText.
      68             :     **/
      69             :     virtual void        ReadCharChain(
      70             :                             CharacterSource &   io_rText ) = 0;
      71             :     /** Has to pass the parsed token to a known receiver.
      72             :         If the token is to be parsed further in a different context,
      73             :         PassNewToken() returns false, but the token is NOT cut from io_rText.
      74             : 
      75             :         @return true, if a token was passed.
      76             :                 false, if the token was not parsed completely by this context
      77             :                        or if the token is to be ignored.
      78             :     */
      79             :     virtual bool        PassNewToken() = 0;
      80             :     virtual TkpContext &
      81             :                         FollowUpContext() = 0;
      82             : };
      83             : 
      84             : class StateMachineContext
      85             : {
      86             :   public:
      87             :     typedef TextToken::F_CRTOK F_CRTOK;
      88             : 
      89           0 :     virtual ~StateMachineContext() {}
      90             : 
      91             :     virtual void        PerformStatusFunction(
      92             :                             uintt               i_nStatusSignal,
      93             :                             F_CRTOK             i_fTokenCreateFunction,
      94             :                             CharacterSource &   io_rText ) = 0;
      95             : };
      96             : 
      97             : class TkpNullContext : public TkpContext
      98             : {
      99             :   public:
     100             :                         ~TkpNullContext();
     101             : 
     102             :     virtual void        ReadCharChain(
     103             :                             CharacterSource &   io_rText );
     104             :     virtual bool        PassNewToken();
     105             :     virtual TkpContext &
     106             :                         FollowUpContext();
     107             : };
     108             : 
     109             : namespace autodoc
     110             : {
     111             : 
     112             : class TkpDocuContext : public TkpContext
     113             : {
     114             :   public:
     115             :     virtual void        SetParentContext(
     116             :                             TkpContext &        io_rParentContext,
     117             :                             const char *        i_sMultiLineEndToken ) = 0;
     118             :     virtual void        AssignDealer(
     119             :                             TokenDealer &       o_rDealer ) = 0;
     120             :     virtual void        SetMode_IsMultiLine(
     121             :                             bool                i_bTrue ) = 0;
     122             : };
     123             : 
     124             : } // namespace autodoc
     125             : 
     126             : #endif
     127             : 
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10