FastUIDraw
static_resource.hpp
Go to the documentation of this file.
1 /*!
2  * \file static_resource.hpp
3  * \brief file static_resource.hpp
4  *
5  * Copyright 2016 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 
20 #ifndef FASTUIDRAW_STATIC_RESOURCE_HPP
21 #define FASTUIDRAW_STATIC_RESOURCE_HPP
22 
24 
25 namespace fastuidraw
26 {
27 /*!\addtogroup Utility
28  * @{
29  */
30 
31  /*!
32  * Generate and store a resource for use. Once a resource is added it
33  * cannot be removed.
34  * \param resource_label "name" of resource, the string is copied
35  * \param value "value" of resource, the data behind value is copied
36  */
37  void
38  generate_static_resource(c_string resource_label, c_array<const uint8_t> value);
39 
40  /*!
41  * Generate and store a resource for use. Once a resource is added it
42  * cannot be removed.
43  * \param resource_label "name" of resource, the string is copied
44  * \param value "value" of resource, the data behind value is copied,
45  * the value is though of as a string and thus must be
46  * null-terminated. The created resource includes the
47  * end-of-string marker.
48  */
49  void
50  generate_static_resource(c_string resource_label, c_string value);
51 
52  /*!
53  * Returns the data behind a resource. If no resource is found,
54  * returns an empty const_c_array.
55  * \param resource_label label of resource as specified
56  * by generate_static_resource().
57  */
58  c_array<const uint8_t>
59  fetch_static_resource(c_string resource_label);
60 
61  /*!
62  * \brief
63  * Provided as a conveniance. The ctor calls
64  * generate_static_resource().
65  */
67  {
68  public:
69  /*!
70  * Ctor.
71  * On construction, calls generate_static_resource().
72  * \param resource_label resource label to pass to generate_static_resource()
73  * \param value value of resource to pass to generate_static_resource()
74  */
75  static_resource(c_string resource_label, c_array<const uint8_t> value);
76  };
77 /*! @} */
78 }
79 
80 #endif
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
c_array< const uint8_t > fetch_static_resource(c_string resource_label)
void generate_static_resource(c_string resource_label, c_array< const uint8_t > value)
Provided as a conveniance. The ctor calls generate_static_resource().
file c_array.hpp
static_resource(c_string resource_label, c_array< const uint8_t > value)
const char * c_string
Conveniant typedef for C-style strings.
Definition: util.hpp:135