RTEMS Linker  0.0.1
RTEMS Tools Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
/Users/chris/Development/rtems/src/apps/rtl-host.chrisj/pkgconfig.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, Chris Johns <chrisj@rtems.org>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #if !defined (_PKGCONFIG_H_)
18 #define _PKGCONFIG_H_
19 
20 #include <map>
21 #include <string>
22 
23 namespace pkgconfig
24 {
25  /**
26  * A simple class to parse a pkgconfig file as used in RTEMS. The RTEMS use
27  * is simple and basically provides a simplified method to manage the various
28  * flags used to build and link modules for a specific BSP.
29  */
30  class package
31  {
32  public:
33  /**
34  * The type of defines and fields parsed from a package config file.
35  */
36  typedef std::map < std::string, std::string > table;
37 
38  package ();
39 
40  /**
41  * Load a package configuration file.
42  *
43  * @param name The file name of the package.
44  */
45  void load (const std::string& name);
46 
47  /**
48  * Get a field from the package.
49  *
50  * @param label The label to search for.
51  * @param result The result of the search.
52  * @retval true The field was found.
53  * @retval false The field was not found.
54  */
55  bool get (const std::string& label, std::string& result);
56 
57  private:
58  table defines; ///< The defines.
59  table fields; ///< The fields.
60 
61  };
62 
63 }
64 
65 #endif