@startuml !include style.ipuml ' !include hide-groups.ipuml ' !include hide-details.ipuml class main as "main()" hide main circle hide main members exception Exception { + Exception(const char* fmt, ...) + what() : const char* -- # error : char* # va_format(va_list args, const char* fmt) } rectangle Group_FileReading as "File reading" <> { class FileReader <> { +open(url) : FileStrategy& } interface FileStrategy { + read() : string + close() -- # open(string url) # clone() : FileStrategy* <> } class LocalFile { - instance : LocalFile <> } class HTTPFile { - instance : HTTPFile <> } package CPR { class Response <> class Url <> } FileStrategy <|.. LocalFile FileStrategy <|.. HTTPFile FileStrategy <. FileReader FileStrategy .> FileReader HTTPFile --> CPR.Response CPR.Response - CPR.Url } rectangle Group_ParsingDeserialization as "Parsing & deserialization" <> { class Parser { + parse(File, Deserializer) <> + register_strategy(ParserStrategy) <> } interface ParserStrategy { + parse(File, Deserializer) <> + heuristic(File) : unsigned int <> } ParserStrategy .> Parser ParserStrategy <. Parser class CSVParser class XMLParser class TXTParser CSVParser ..|> ParserStrategy TXTParser ..|> ParserStrategy XMLParser ..|> ParserStrategy class Deserializer { + set_target(Museum &) + add_artist(uniq) + set_rows(unsigned int) + set_cols(unsigned int) + add_type(string, Color, unsigned int) + add_tile(unsigned int x, unsigned int y, uniq) } CSVParser -up-> Deserializer XMLParser -up-> Deserializer TXTParser -up-> Deserializer ' ParserStrategy ..> Deserializer } rectangle Group_Model as "Model" <> { class Canvas { + get_tile(x, y) + set_tile(x, y, TileData) - data : CanvasData - tiles : Tile[] } class People { + add_artist(uniq) - artists : Artist[] } class Museum { - people : People - canvas : Canvas } class Tile { + data : TileData } struct TileData { + type : string } class Artist { + update() -- - data : ArtistData } struct ArtistData { + x : float + y : float + vx : float + vy : float } struct CanvasData { + rows : unsigned int + columns : unsigned int } rectangle Group_Tile_Appearance as "Tile appearance" <> { struct Color { red : unsigned int green : unsigned int blue : unsigned int } class TileAppearance { + get_color(string) : Color <> + register_color(string, Color) <> } Tile --> Color Color <.. TileAppearance } rectangle Group_Tile_Behavior as "Tile behavior" <> { interface TileBehaviorStrategy class TileBehavior together { class NullTileBehavior class GrayTileBehavior class RedTileBehavior class BlueTileBehavior class YellowTileBehavior NullTileBehavior -d[hidden]- GrayTileBehavior GrayTileBehavior -d[hidden]- RedTileBehavior RedTileBehavior -d[hidden]- BlueTileBehavior BlueTileBehavior -d[hidden]- YellowTileBehavior } TileBehaviorStrategy <|.. NullTileBehavior TileBehaviorStrategy <|.. GrayTileBehavior TileBehaviorStrategy <|.. RedTileBehavior TileBehaviorStrategy <|.. BlueTileBehavior TileBehaviorStrategy <|.. YellowTileBehavior Tile --> "state" TileBehavior TileBehavior .> TileBehaviorStrategy TileBehavior <. TileBehaviorStrategy } Museum --> People Museum --> Canvas Canvas --> Tile People --> Artist Tile --> TileData Artist --> ArtistData Canvas -> CanvasData ' LAYOUT Artist -r[hidden] Tile } rectangle "Visualization" <> { struct Rectangle { x : unsigned int y : unsigned int width : unsigned int height : unsigned int } package SDL2 { } class View { } class ViewController { + update() } ViewController --> View View --> SDL2 } ' PeopleDeserializer <... People ' CanvasDeserializer <... Canvas ' Deserializer <... Museum ParserStrategy ..> FileStrategy ' Museum .> Deserializer : friend Deserializer .> Museum @enduml