1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2020 Red Hat, Inc.
5
6 /// @file
7
8 #if defined(USE_ANDROID_BUILD_NUMBER)
9 #include <build/version.h>
10 #endif
11
12 #include "abg-internal.h"
13 // <headers defining libabigail's API go under here>
14 ABG_BEGIN_EXPORT_DECLARATIONS
15
16 #include "abg-config.h"
17 #include "abg-version.h"
18
19 ABG_END_EXPORT_DECLARATIONS
20 // </headers defining libabigail's API>
21
22 namespace abigail
23 {
config()24 config::config()
25 : m_format_minor(ABIGAIL_ABIXML_VERSION_MINOR),
26 m_format_major(ABIGAIL_ABIXML_VERSION_MAJOR),
27 m_xml_element_indent(2),
28 m_tu_instr_suffix(".bi"),
29 m_tu_instr_archive_suffix(".abi")
30 {
31 }
32
33 const std::string&
get_format_minor_version_number() const34 config::get_format_minor_version_number() const
35 {return m_format_minor;}
36
37 void
set_format_minor_version_number(const std::string & v)38 config::set_format_minor_version_number(const std::string& v)
39 {m_format_minor = v;}
40
41 const std::string&
get_format_major_version_number() const42 config::get_format_major_version_number() const
43 {return m_format_major;}
44
45 void
set_format_major_version_number(const std::string & v)46 config::set_format_major_version_number(const std::string& v)
47 {m_format_major= v;}
48
49 unsigned
get_xml_element_indent() const50 config::get_xml_element_indent() const
51 { return m_xml_element_indent; }
52
53 void
set_xml_element_indent(unsigned indent)54 config::set_xml_element_indent(unsigned indent)
55 {m_xml_element_indent = indent;}
56
57 const std::string&
get_tu_instr_suffix() const58 config::get_tu_instr_suffix() const
59 {return m_tu_instr_suffix;}
60
61 void
set_tu_instr_suffix(const std::string & s)62 config::set_tu_instr_suffix(const std::string& s)
63 {m_tu_instr_suffix = s;}
64
65 const std::string&
get_tu_instr_archive_suffix() const66 config::get_tu_instr_archive_suffix() const
67 {return m_tu_instr_archive_suffix;}
68
69 void
set_tu_instr_archive_suffix(const std::string & s)70 config::set_tu_instr_archive_suffix(const std::string& s)
71 {m_tu_instr_archive_suffix = s; }
72
73 extern "C"
74 {
75 /// Return the relevant version numbers of the library.
76 ///
77 /// @param maj the major version number of the library.
78 ///
79 /// @param min the minor version number of the library.
80 ///
81 /// @param rev the revision version number of the library.
82 ///
83 /// @param suf the version suffix of the library.
84 void
abigail_get_library_version(std::string & major,std::string & minor,std::string & revision,std::string & suffix)85 abigail_get_library_version(std::string& major,
86 std::string& minor,
87 std::string& revision,
88 std::string& suffix)
89 {
90 major = ABIGAIL_VERSION_MAJOR;
91 minor = ABIGAIL_VERSION_MINOR;
92 revision = ABIGAIL_VERSION_REVISION;
93 #if defined(USE_ANDROID_BUILD_NUMBER)
94 // Android edit: there is no compile time constant for build number.
95 suffix = android::build::GetBuildNumber();
96 #else
97 suffix = ABIGAIL_VERSION_SUFFIX;
98 #endif
99 }
100
101 /// Return the version numbers for the ABIXML format.
102 ///
103 /// @param maj the major version number of the ABIXML format.
104 ///
105 /// @param min the minor version number of the ABIXML format.
106 void
abigail_get_abixml_version(std::string & major,std::string & minor)107 abigail_get_abixml_version(std::string& major,
108 std::string& minor)
109 {
110 major = ABIGAIL_ABIXML_VERSION_MAJOR;
111 minor = ABIGAIL_ABIXML_VERSION_MINOR;
112 }
113
114 }
115 }//end namespace abigail
116