HoverRace  2.0
LocalProfile.h
Go to the documentation of this file.
1 
2 // LocalProfile.h
3 //
4 // Copyright (c) 2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "Profile.h"
25 
26 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
27 # ifdef MR_ENGINE
28 # define MR_DllDeclare __declspec( dllexport )
29 # else
30 # define MR_DllDeclare __declspec( dllimport )
31 # endif
32 #else
33 # define MR_DllDeclare
34 #endif
35 
36 namespace HoverRace {
37  namespace Util {
38  namespace yaml {
39  class MapNode;
40  }
41  }
42 }
43 
44 namespace HoverRace {
45 namespace Player {
46 
52 {
53  using SUPER = Profile;
54 
55 public:
56  LocalProfile() = delete;
57  LocalProfile(std::shared_ptr<AvatarGallery> avatarGallery);
58  LocalProfile(std::shared_ptr<AvatarGallery> avatarGallery,
59  const boost::uuids::uuid &uid);
60  virtual ~LocalProfile() { }
61 
62 public:
63  bool isLoaded() const { return loaded; }
64 
65  std::shared_ptr<Display::Res<Display::Texture>> GetAvatar() const override;
66 
67 private:
68  void Load(Util::yaml::MapNode *root, const std::string &filename);
69 
70 public:
71  EditableProfile *Edit() override { return this; }
72  RenamableProfile *EditName() override { return this; }
73 
74 protected:
75  void Save() override;
76 
77 private:
78  bool loaded;
79 };
80 
81 } // namespace Player
82 } // namespace HoverRace
83 
84 #undef MR_DllDeclare
virtual ~LocalProfile()
Definition: LocalProfile.h:60
RenamableProfile * EditName() override
Retrieve an renamable view of this profile.
Definition: LocalProfile.h:72
A profile that is stored on the local filesystem.
Definition: LocalProfile.h:51
EditableProfile * Edit() override
Retrieve an editable view of this profile.
Definition: LocalProfile.h:71
bool loaded
Definition: LocalProfile.h:78
bool isLoaded() const
Definition: LocalProfile.h:63
Definition: MapNode.h:34
Interface for profiles than can be renamed.
Definition: EditableProfile.h:59
Base class for player profiles.
Definition: Profile.h:56
Definition: Announcement.h:24
Interface for profile editing.
Definition: EditableProfile.h:43
#define MR_DllDeclare
Definition: LocalProfile.h:33