1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef _SDPERRORHOLDER_H_ 8 #define _SDPERRORHOLDER_H_ 9 10 #include <vector> 11 #include <string> 12 13 namespace mozilla 14 { 15 16 class SdpErrorHolder 17 { 18 public: SdpErrorHolder()19 SdpErrorHolder() {} ~SdpErrorHolder()20 virtual ~SdpErrorHolder() {} 21 22 void AddParseError(size_t line,const std::string & message)23 AddParseError(size_t line, const std::string& message) 24 { 25 mErrors.push_back(std::make_pair(line, message)); 26 } 27 28 void ClearParseErrors()29 ClearParseErrors() 30 { 31 mErrors.clear(); 32 } 33 34 /** 35 * Returns a reference to the list of parse errors. 36 * This gets cleared out when you call Parse. 37 */ 38 const std::vector<std::pair<size_t, std::string> >& GetParseErrors()39 GetParseErrors() const 40 { 41 return mErrors; 42 } 43 44 private: 45 std::vector<std::pair<size_t, std::string> > mErrors; 46 }; 47 48 } // namespace mozilla 49 50 #endif 51