source: rtems-tools/rtemstoolkit/pkgconfig.h @ 3618a62

Last change on this file since 3618a62 was 87e0e76, checked in by Chris Johns <chrisj@…>, on Sep 13, 2014 at 2:09:16 AM

Refactor code into the RTEMS Toolkit.

  • Property mode set to 100644
File size: 2.0 KB
Line 
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
23namespace 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    /**
39     * Constructor and load the file.
40     */
41    package (const std::string& name);
42
43    /**
44     * Default constructor.
45     */
46    package ();
47
48    /**
49     * Load a package configuration file.
50     *
51     * @param name The file name of the package.
52     */
53    void load (const std::string& name);
54
55    /**
56     * Get a field from the package.
57     *
58     * @param label The label to search for.
59     * @param result The result of the search.
60     * @retval true The field was found.
61     * @retval false The field was not found.
62     */
63    bool get (const std::string& label, std::string& result);
64
65  private:
66    table defines;  ///< The defines.
67    table fields;   ///< The fields.
68  };
69
70}
71
72#endif
Note: See TracBrowser for help on using the repository browser.