forked from ElementsProject/elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassetsdir.h
49 lines (37 loc) · 1.24 KB
/
assetsdir.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2017-2017 The Elements Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_ASSETSDIR_H
#define BITCOIN_ASSETSDIR_H
#include "amount.h"
#include <map>
class AssetMetadata
{
std::string label;
public:
AssetMetadata() : label("") {};
AssetMetadata(std::string _label) : label(_label) {};
const std::string& GetLabel() const
{
return label;
}
};
class CAssetsDir
{
std::map<CAsset, AssetMetadata> mapAssetMetadata;
std::map<std::string, CAsset> mapAssets;
void Set(const CAsset& asset, const AssetMetadata& metadata);
void SetHex(const std::string& assetHex, const std::string& label);
public:
void InitFromStrings(const std::vector<std::string>& assetsToInit);
/**
* @param label A label string
* @return asset id corresponding to the asset label
*/
CAsset GetAsset(const std::string& label) const;
AssetMetadata GetMetadata(const CAsset& asset) const;
/** @return the label associated to the asset id */
std::string GetLabel(const CAsset& asset) const;
std::vector<CAsset> GetKnownAssets() const;
};
#endif // BITCOIN_ASSETSDIR_H