GUIDOLib  1.7.7
Guido Engine Internal Documentation
GuidoStream.h
1 #ifndef __GuidoStream__
2 #define __GuidoStream__
3 
4 /*
5  GUIDO Library
6  Copyright (C) 2013 Grame
7 
8  This Source Code Form is subject to the terms of the Mozilla Public
9  License, v. 2.0. If a copy of the MPL was not distributed with this
10  file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12  Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
13  research@grame.fr
14 
15  */
16 
17 #include <istream>
18 #include <sstream>
19 #include <stack>
20 
21 #include "ARFactory.h"
22 
23 
25 {
26 public:
28  virtual ~GuidoStream() {}
29 
30  void WriteToStream(const char* str);
31 
32  void ReinitStream();
33 
34  std::string getStreamStr() const;
35  const std::string getGuidoCode() const { return fGMNCode;}
36 
37 protected:
38  std::stringstream fInputStream; // The stringstream which contains the real string
39  // written by the user since the beginning
40  std::string fGMNCode; // The completed input stream (syntactically correct gmn code)
41 
42  /* Builds the tags ( "{", "[", "(", "<" ) stack from inStr */
43  void AnalyzeString(const std::stringstream& inStr, std::stack<char>& stack);
44 
45  /* Complete stringToComplete with appropriate tags contained in inStack */
46  void WriteNewString(std::stack<char>& inStack, std::string& stringToComplete);
47 };
48 
49 
50 #endif
GuidoStream
Definition: GuidoStream.h:24
GuidoStream::~GuidoStream
virtual ~GuidoStream()
Definition: GuidoStream.h:28
GuidoStream::getGuidoCode
const std::string getGuidoCode() const
Definition: GuidoStream.h:35
GuidoStream::WriteNewString
void WriteNewString(std::stack< char > &inStack, std::string &stringToComplete)
GuidoStream::AnalyzeString
void AnalyzeString(const std::stringstream &inStr, std::stack< char > &stack)
GuidoStream::fInputStream
std::stringstream fInputStream
Definition: GuidoStream.h:38
GuidoStream::GuidoStream
GuidoStream()
Definition: GuidoStream.h:27
GuidoStream::ReinitStream
void ReinitStream()
GuidoStream::getStreamStr
std::string getStreamStr() const
GuidoStream::WriteToStream
void WriteToStream(const char *str)
GuidoStream::fGMNCode
std::string fGMNCode
Definition: GuidoStream.h:40

Guido Project Copyright © 2019 Grame-CNCM