From 764c3a1e4f21c635c565cf5c20c480dbf48d1599 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 19 Jan 2010 16:48:54 +0100 Subject: unify "crash data, "crash info" and "crash report" data types. they are the same Signed-off-by: Denys Vlasenko --- inc/CrashTypes.h | 52 +++++++++++++++++++++++++++++--------------------- inc/CrashTypesSocket.h | 12 ++++++------ 2 files changed, 36 insertions(+), 28 deletions(-) (limited to 'inc') diff --git a/inc/CrashTypes.h b/inc/CrashTypes.h index ccbdd929..4778b707 100644 --- a/inc/CrashTypes.h +++ b/inc/CrashTypes.h @@ -1,3 +1,21 @@ +/* + Copyright (C) 2009 Abrt team. + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ #ifndef CRASHTYPES_H_ #define CRASHTYPES_H_ @@ -40,29 +58,19 @@ // typedef map_vector_string_t map_crash_data_t; -typedef map_crash_data_t map_crash_info_t; -typedef map_crash_data_t map_crash_report_t; -typedef std::vector vector_crash_infos_t; +typedef std::vector vector_map_crash_data_t; -inline void add_crash_data_to_crash_info(map_crash_info_t& pCrashInfo, - const std::string& pItem, - const std::string& pContent) -{ - pCrashInfo[pItem].push_back(CD_TXT); - pCrashInfo[pItem].push_back(CD_ISNOTEDITABLE); - pCrashInfo[pItem].push_back(pContent); -} +void add_to_crash_data(map_crash_data_t& pCrashData, + const char *pItem, + const char *pContent); -inline void add_crash_data_to_crash_report(map_crash_report_t& pCrashReport, - const std::string& pItem, - const std::string& pType, - const std::string& pEditable, - const std::string& pContent) -{ - pCrashReport[pItem].push_back(pType); - pCrashReport[pItem].push_back(pEditable); - pCrashReport[pItem].push_back(pContent); -} +void add_to_crash_data_ext(map_crash_data_t& pCrashData, + const char *pItem, + const char *pType, + const char *pEditable, + const char *pContent); +const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, + const char *key); -#endif /* CRASHTYPES_H_ */ +#endif diff --git a/inc/CrashTypesSocket.h b/inc/CrashTypesSocket.h index 166a8a81..db3ee44e 100644 --- a/inc/CrashTypesSocket.h +++ b/inc/CrashTypesSocket.h @@ -70,19 +70,19 @@ #define MESSAGE_CREATE_REPORT "(CREATE_REPORT)" #define MESSAGE_END_MARKER 23 -std::string crash_infos_to_string(const vector_crash_infos_t& pCrashInfos); +std::string crash_infos_to_string(const vector_map_crash_data_t& pCrashDatas); std::string crash_data_to_string(const map_crash_data_t& pCrashData); -inline std::string crash_report_to_string(const map_crash_report_t& pCrashReport) +inline std::string crash_report_to_string(const map_crash_data_t& pCrashData) { - return crash_data_to_string(pCrashReport); + return crash_data_to_string(pCrashData); } -vector_crash_infos_t string_to_crash_infos(const std::string& pMessage); +vector_map_crash_data_t string_to_crash_infos(const std::string& pMessage); map_crash_data_t string_to_crash_data(const std::string& pMessage, int& len); -inline map_crash_report_t string_to_crash_report(const std::string& pMessage) +inline map_crash_data_t string_to_crash_report(const std::string& pMessage) { int len; return string_to_crash_data(pMessage, len); } -#endif /* SOCKETCRASHTYPES_H_ */ +#endif -- cgit