WSF
WsfParseAlternate.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11// ****************************************************************************
12// Updated by Infoscitex, a DCS Company.
13// ****************************************************************************
14
15#ifndef WSFPARSEALTERNATE_HPP
16#define WSFPARSEALTERNATE_HPP
17#include "WsfParseRule.hpp"
19
20// A list of alternates
22{
23public:
31 ~WsfParseAlternate() override;
32 WsfParseAlternate(const WsfParseAlternate&) = default; // copy constructor
33
34 bool Read(WsfParser& aParser, WsfParseNode*& aNode) override;
35
36 bool ReadRange(WsfParser& aParser, UtTextDocumentRange& aRange, WsfParseNode*& aNode, bool aCreateNode) override;
37
38 virtual void Initialize();
39
40 const std::vector<WsfParseRule*>& GetReaders() const { return mAlternates; }
41
42 std::vector<WsfParseRule*> GetAlternates() override { return mAlternates; }
43
44
45 const std::vector<WsfParseRule*>& Alternates() const { return mAlternates; }
46 std::vector<WsfParseRule*>& Alternates() { return mAlternates; }
47 std::vector<WsfParseRule*>& ChangeAlternates() { return mAlternates; }
48 void AddAlternate(WsfParseRule* aSequence);
50 std::string GetRuleDescription() override;
51
52protected:
53 std::vector<WsfParseRule*> mAlternates;
54
55
56 int ReaderStartsWithChar(WsfParseRule* aReaderPtr, char aChar);
57 void ClearAccelerators();
58
60 {
61 std::vector<int> mChildIndices;
62 };
63
65 // For each starting character, the list of possible children that can read
66 std::vector<CharacterAccelerator*> mAccelerators;
67 // The list of reader child indices that must be tested each time
69};
70
71#endif
std::vector< WsfParseRule * > & Alternates()
Definition WsfParseAlternate.hpp:46
virtual void Initialize()
Definition WsfParseAlternate.cpp:127
bool ReadRange(WsfParser &aParser, UtTextDocumentRange &aRange, WsfParseNode *&aNode, bool aCreateNode) override
Definition WsfParseAlternate.cpp:115
WsfParseAlternate(WsfParseRuleMemory &aMem)
Definition WsfParseAlternate.hpp:24
bool mFixedLength
Definition WsfParseAlternate.hpp:64
std::string GetRuleDescription() override
Definition WsfParseAlternate.cpp:266
WsfParseAlternate(const WsfParseAlternate &)=default
~WsfParseAlternate() override
Definition WsfParseAlternate.cpp:35
std::vector< WsfParseRule * > GetAlternates() override
Definition WsfParseAlternate.hpp:42
void AddAlternate(WsfParseRule *aSequence)
Definition WsfParseAlternate.cpp:256
const std::vector< WsfParseRule * > & Alternates() const
Definition WsfParseAlternate.hpp:45
std::vector< WsfParseRule * > & ChangeAlternates()
Definition WsfParseAlternate.hpp:47
int ReaderStartsWithChar(WsfParseRule *aReaderPtr, char aChar)
Definition WsfParseAlternate.cpp:176
bool Read(WsfParser &aParser, WsfParseNode *&aNode) override
Definition WsfParseAlternate.cpp:40
const std::vector< WsfParseRule * > & GetReaders() const
Definition WsfParseAlternate.hpp:40
std::vector< CharacterAccelerator * > mAccelerators
Definition WsfParseAlternate.hpp:66
std::vector< WsfParseRule * > mAlternates
Definition WsfParseAlternate.hpp:53
CharacterAccelerator mUnfiltered
Definition WsfParseAlternate.hpp:68
void ClearAccelerators()
Definition WsfParseAlternate.cpp:247
void Swap(WsfParseAlternate &aRhs)
Definition WsfParseAlternate.hpp:49
Definition WsfParseNode.hpp:61
Definition WsfParseRule.hpp:263
Definition WsfParseRule.hpp:131
WsfParseRule(WsfParseRuleMemory &aMem, RuleType aType)
Definition WsfParseRule.cpp:85
@ cALTERNATE
Definition WsfParseRule.hpp:139
Definition WsfParseSequence.hpp:21
Definition WsfParser.hpp:36
void swap(WsfRoute &aLhs, WsfRoute &aRhs)
Definition WsfRoute.hpp:294
Definition WsfParseAlternate.hpp:60
std::vector< int > mChildIndices
Definition WsfParseAlternate.hpp:61
Copyrights Multiple, All Rights Reserved