Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TracyUserData.hpp « server - github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d8e366d318b01a952e42c6b16e20b070c96d846e (plain)
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
50
51
52
53
54
55
#ifndef __TRACYUSERDATA_HPP__
#define __TRACYUSERDATA_HPP__

#include <memory>
#include <stdint.h>
#include <stdio.h>
#include <string>
#include <vector>

namespace tracy
{

struct Annotation;
struct SourceRegex;
struct ViewData;

class UserData
{
public:
    UserData();
    UserData( const char* program, uint64_t time );

    bool Valid() const { return !m_program.empty(); }
    void Init( const char* program, uint64_t time );

    const std::string& GetDescription() const { return m_description; }
    bool SetDescription( const char* description );

    void LoadState( ViewData& data );
    void SaveState( const ViewData& data );
    void StateShouldBePreserved();

    void LoadAnnotations( std::vector<std::unique_ptr<Annotation>>& data );
    void SaveAnnotations( const std::vector<std::unique_ptr<Annotation>>& data );

    bool LoadSourceSubstitutions( std::vector<SourceRegex>& data );
    void SaveSourceSubstitutions( const std::vector<SourceRegex>& data );

    const char* GetConfigLocation() const;

private:
    FILE* OpenFile( const char* filename, bool write );
    void Remove( const char* filename );

    std::string m_program;
    uint64_t m_time;

    std::string m_description;

    bool m_preserveState;
};

}

#endif