errorcorrelator.h
来自「C++高级编程这本书所附的源代码」· C头文件 代码 · 共 47 行
H
47 行
#include <ostream>#include <string>#include <queue>#include <stdexcept>// Sample Error class with just a priority and a string error description.class Error{ public: Error(int priority, std::string errMsg) : mPriority(priority), mError(errMsg) {} int getPriority() const {return mPriority; } std::string getErrorString() const {return mError; } friend bool operator<(const Error& lhs, const Error& rhs); friend std::ostream& operator<<(std::ostream& str, const Error& err); protected: int mPriority; std::string mError;};// Simple ErrorCorrelator class that returns highest priority errors first.class ErrorCorrelator{ public: ErrorCorrelator() {} // // Add an error to be correlated. // void addError(const Error& error); // // Retrieve the next error to be processed // Error getError() throw (std::out_of_range); protected: std::priority_queue<Error> mErrors; private: // prevent assignment and pass-by-reference ErrorCorrelator(const ErrorCorrelator& src); ErrorCorrelator& operator=(const ErrorCorrelator& rhs);};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?