GUIDOLib  1.7.7
A Music Score Rendering Engine
Functions
Parsing GMN files, strings and guido streams

Functions

GuidoParser * openParser ()
 Creates a new parser. More...
 
GuidoErrCode closeParser (GuidoParser *p)
 Close a guido parser and releases all the associated ressources. More...
 
ARHandler file2AR (GuidoParser *parser, const std::string &file)
 Parse a file and create the corresponding AR. More...
 
ARHandler string2AR (GuidoParser *parser, const std::string &gmnCode)
 Parse a string and create the corresponding AR. More...
 
std::string getStream (const GuidoStream *gStream) const
 returns the string of the stream More...
 
ARHandler stream2AR (GuidoParser *p, GuidoStream *stream)
 Parse a stream and create the corresponding AR. More...
 
ParserError parserGetErrorCode (GuidoParser *p)
 Get the error syntax line/column/message. More...
 
GuidoStream * openStream ()
 Open a guido stream. More...
 
GuidoErrCode closeStream (GuidoStream *s)
 Close a guido stream. More...
 
GuidoErrCode writeStream (GuidoStream *s, const std::string &str)
 Write data to the stream. More...
 
GuidoErrCode resetStream (GuidoStream *s)
 Erase all stream content in order to reuse it. More...
 

Detailed Description

Function Documentation

◆ closeParser()

GuidoErrCode closeParser ( GuidoParser *  p)

Close a guido parser and releases all the associated ressources.

Parameters
pa parser previously opened with openParser
Returns
a Guido error code.

◆ closeStream()

GuidoErrCode closeStream ( GuidoStream *  s)

Close a guido stream.

Parameters
sa stream
Returns
a Guido error code.

◆ file2AR()

ARHandler file2AR ( GuidoParser *  parser,
const std::string &  file 
)

Parse a file and create the corresponding AR.

Parameters
parsera parser previously opened with openParser
filethe file to parse.
Returns
a ARHandler or 0 in case of error.

◆ getStream()

std::string getStream ( const GuidoStream *  gStream) const

returns the string of the stream

Parameters
gStreama stream
Returns
a std::string.

◆ openParser()

GuidoParser* openParser ( )

Creates a new parser.

Returns
a guido parser.

◆ openStream()

GuidoStream* openStream ( )

Open a guido stream.

Guido streams are intended to implement real-time input to the parser. In particular, streams allow to retrieve an AR in while the stream is still opened.

Returns
a guido stream.

◆ parserGetErrorCode()

ParserError parserGetErrorCode ( GuidoParser *  p)

Get the error syntax line/column/message.

Parameters
pa parser previously opened with openParser
Returns
a ParserError structure.

◆ resetStream()

GuidoErrCode resetStream ( GuidoStream *  s)

Erase all stream content in order to reuse it.

Parameters
sa stream previoulsy opened with openStream
Returns
a Guido error code.

◆ stream2AR()

ARHandler stream2AR ( GuidoParser *  p,
GuidoStream *  stream 
)

Parse a stream and create the corresponding AR.

Parameters
pa parser previously opened with openParser
streamthe stream to parse.
Returns
a ARHandler or 0 in case of error.

◆ string2AR()

ARHandler string2AR ( GuidoParser *  parser,
const std::string &  gmnCode 
)

Parse a string and create the corresponding AR.

Parameters
parsera parser previously opened with openParser
gmnCodethe string to parse.
Returns
a ARHandler or 0 in case of error.

◆ writeStream()

GuidoErrCode writeStream ( GuidoStream *  s,
const std::string &  str 
)

Write data to the stream.

Writing data to a stream may be viewed as writing gmn code by portion. Syntax errors concerning music/voice/tag/event/parameter non-closure won't be declared as such (GuidoWriteStream uses an automatic-closure mechanism). When a syntax error (other than a non-closure) occurs when writting data to the stream, the stream becomes invalid and should be closed. Further attempts to write data will always result in a syntax error.

Regarding syntax errors, allowed incomplete constructs are :

  • opened music i.e. { without closing }
  • opened voice i.e. [ without closing ]
  • opened range tag i.e. ( without closing )
  • opened range parameter i.e. < without closing > but with at least one parameter
  • opened chord i.e. ( without closing ) but with at least one note
    Note
    for incomplete chords and range parameters, the ',' separator must always be followed by a note or a parameter. For example, don't write "{a," and then "b}" but "{a" and then ",b}".
    Parameters
    sa stream previoulsy opened with openStream
    stra string containing a portion of gmn code
    Returns
    a Guido error code.

Guido Project Copyright © 2019 Grame-CNCM