libqasm
library for handling cQASM files
Classes | Functions
cqasm::version Namespace Reference

Detailed Description

Namespace for detecting and dealing with cQASM language versions.

Classes

class  ParseHelper
 Internal helper class for parsing cQASM file versions. More...
 
class  Version
 Version number primitive used within the AST and semantic trees. More...
 

Functions

std::ostream & operator<< (std::ostream &os, const Version &object)
 Stream << overload for version nodes. More...
 
Version parse_file (const std::string &filename)
 Parse the given file to get its version number. More...
 
Version parse_file (FILE *file, const std::string &filename)
 Parse using the given file pointer to get its version number. More...
 
Version parse_string (const std::string &data, const std::string &filename)
 Parse the given string as a file to get its version number. More...
 

Function Documentation

◆ operator<<()

std::ostream & cqasm::version::operator<< ( std::ostream &  os,
const Version object 
)

Stream << overload for version nodes.

Definition at line 64 of file cqasm-version.cpp.

◆ parse_file() [1/2]

Version cqasm::version::parse_file ( const std::string &  filename)

Parse the given file to get its version number.

Parse the given file.

Throws an AnalysisError if this fails.

Definition at line 81 of file cqasm-version.cpp.

◆ parse_file() [2/2]

Version cqasm::version::parse_file ( FILE *  file,
const std::string &  filename 
)

Parse using the given file pointer to get its version number.

Parse using the given file pointer.

Throws an AnalysisError if this fails. The file is rewound back to the start when parsing completes.

Definition at line 90 of file cqasm-version.cpp.

◆ parse_string()

Version cqasm::version::parse_string ( const std::string &  data,
const std::string &  filename 
)

Parse the given string as a file to get its version number.

Parse the given string.

A filename may be given in addition for use within the AnalysisError thrown when version parsing fails.

Definition at line 103 of file cqasm-version.cpp.