fileline.h Source File¶ API: fileline.h Source File API includeomnetpp fileline.h 1//========================================================================== 2// FILELINE.H - part of 3// OMNeT++/OMNEST 4// Discrete System Simulation in C++ 5// 6//========================================================================== 7 8/*--------------------------------------------------------------* 9 Copyright (C) 1992-2017 Andras Varga 10 Copyright (C) 2006-2017 OpenSim Ltd. 11 12 This file is distributed WITHOUT ANY WARRANTY. See the file 13 `license' for details on this and other legal matters. 14*--------------------------------------------------------------*/ 15 16#ifndef __OMNETPP_FILELINE_H 17#define __OMNETPP_FILELINE_H 18 19#include "simkerneldefs.h" 20#include "opp_pooledstring.h" 21 22namespace omnetpp { 23 27class SIM_API FileLine 28{ 29 private: 30 opp_staticpooledstring file; 31 int line = -1; 32 public: 33 FileLine() {} 34 FileLine(const char *file, int line=-1) : file(file), line(line) {} 35 bool empty() const {return file.empty();} 36 const char *getFilename() const {return file.c_str();} 37 int getLineNumber() const {return line;} 38 std::string str() const {return empty() ? "" : line == -1 ? file.str() : file.str() + ":" + std::to_string(line);} 39}; 40 41} // namespace omnetpp 42 43#endif 44 omnetpp::opp_staticpooledstringDefinition opp_pooledstring.h:30 Generated on for API by 1.14.0