Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Location Class

The Location class keeps track of where we are in a file. More...

 #include <Location>

Public Functions

Location()
Location(const QString & fileName)
Location(const Location & other)
~Location()
void advance(QChar ch)
void advanceLines(int n)
int columnNo() const
int depth() const
void error(const QString & message, const QString & details = QString()) const
bool etc() const
void fatal(const QString & message, const QString & details = QString()) const
QString fileName() const
const QString & filePath() const
bool isEmpty() const
int lineNo() const
void pop()
void push(const QString & filePath)
void setColumnNo(int no)
void setEtc(bool etc)
void setLineNo(int no)
void start()
void warning(const QString & message, const QString & details = QString()) const
Location & operator=(const Location & other)

Static Public Members

void information(const QString & message)
void initialize(const Config & config)
void internalError(const QString & hint)
void terminate()

Detailed Description

The Location class keeps track of where we are in a file.

It maintains a stack of file positions. A file position consists of the file path, line number, and column number. The location is used for printing error messages that are tied to a location in a file.

Member Function Documentation

Location::Location()

Constructs an empty location.

Location::Location(const QString & fileName)

Constructs a location with (fileName, 1, 1) on its file position stack.

Location::Location(const Location & other)

The copy constructor copies the contents of other into this Location using the assignment operator.

Location::~Location()

void Location::advance(QChar ch)

Advance the current file position, using ch to decide how to do that. If ch is a '\\n', increment the current line number and set the column number to 1. If \ch is a '\\t', increment to the next tab column. Otherwise, increment the column number by 1.

The current file position is the one on top of the position stack.

void Location::advanceLines(int n)

int Location::columnNo() const

Returns the current column number. Must not be called on an empty Location object.

See also setColumnNo(), filePath(), and lineNo().

int Location::depth() const

void Location::error(const QString & message, const QString & details = QString()) const

Writes message and detals to stderr as a formatted error message.

bool Location::etc() const

See also setEtc().

void Location::fatal(const QString & message, const QString & details = QString()) const

Writes message and detals to stderr as a formatted error message and then exits the program.

QString Location::fileName() const

Returns the file name part of the file path, ie the current file. Must not be called on an empty Location object.

const QString & Location::filePath() const

Returns the current path and file name. Must not be called on an empty Location object.

See also lineNo() and columnNo().

void Location::information(const QString & message) [static]

Prints message to stdout followed by a '\n'.

void Location::initialize(const Config & config) [static]

Gets several parameters from the config, including tab size, program name, and a regular expression that appears to be used for matching certain error messages so that emitMessage() can avoid printing them.

void Location::internalError(const QString & hint) [static]

Report a program bug, including the hint.

bool Location::isEmpty() const

Returns true if there is no file name set yet; returns false otherwise. The functions filePath(), lineNo() and columnNo() must not be called on an empty Location object.

int Location::lineNo() const

Returns the current line number. Must not be called on an empty Location object.

See also setLineNo(), filePath(), and columnNo().

void Location::pop()

Pops the top of the internal stack. The current file position becomes the next one in the new top of stack.

See also push().

void Location::push(const QString & filePath)

Pushes filePath onto the file position stack. The current file position becomes (filePath, 1, 1).

See also pop().

void Location::setColumnNo(int no)

See also columnNo().

void Location::setEtc(bool etc)

See also etc().

void Location::setLineNo(int no)

See also lineNo().

void Location::start()

If the file position on top of the stack has a line number less than 1, set its line number to 1 and its column number to 1. Otherwise, do nothing.

void Location::terminate() [static]

Apparently, all this does is delete the regular expression used for intercepting certain error messages that should not be emitted by emitMessage().

void Location::warning(const QString & message, const QString & details = QString()) const

Writes message and detals to stderr as a formatted warning message.

Location & Location::operator=(const Location & other)

The assignment operator does a deep copy of the entire state of other into this Location.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web