Design Patterns
font.h
Go to the documentation of this file.
1 // Based on "Design Patterns: Elements of Reusable Object-Oriented Software"
2 // book by Erich Gamma, John Vlissides, Ralph Johnson, and Richard Helm
3 //
4 // Created by Bartosz Rachwal. The National Institute of Advanced Industrial Science and Technology, Japan.
5 
6 #ifndef STRUCTURAL_FLYWEIGHT_FONT_H_
7 #define STRUCTURAL_FLYWEIGHT_FONT_H_
8 
9 #include <string>
10 
11 namespace structural
12 {
13 namespace flyweight
14 {
15 class Font
16 {
17  public:
18  explicit Font(const std::string& name);
19 
20  std::string name() const;;
21 
22  friend bool operator ==(const Font& left_font, const Font& right_font);
23 
24  private:
25  std::string name_;
26 };
27 
28 inline bool operator==(const Font& left_font, const Font& right_font)
29 {
30  auto left_font_name = left_font.name();
31  auto right_font_name = right_font.name();
32  return left_font_name.compare(right_font_name) == 0;
33 }
34 }
35 }
36 
37 #endif
38 
Definition: shape_interface.h:11
bool operator==(const Font &left_font, const Font &right_font)
Definition: font.h:28
Font(const std::string &name)
Definition: font.cc:12
Definition: font.h:15
friend bool operator==(const Font &left_font, const Font &right_font)
Definition: font.h:28
std::string name() const
Definition: font.cc:14