PathMappingList.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
1//===-- PathMappingList.h ---------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_PathMappingList_h_
11#define liblldb_PathMappingList_h_
12
13// C Includes
14// C++ Includes
15#include <map>
16#include <vector>
17// Other libraries and framework includes
18#include "lldb/Core/ConstString.h"
19#include "lldb/Core/Error.h"
20// Project includes
21
22namespace lldb_private {
23
24class PathMappingList
25{
26public:
27
28    typedef void (*ChangedCallback) (const PathMappingList &path_list,
29                                     void *baton);
30
31    //------------------------------------------------------------------
32    // Constructors and Destructors
33    //------------------------------------------------------------------
34    PathMappingList (ChangedCallback callback,
35                     void *callback_baton);
36
37    virtual
38    ~PathMappingList ();
39
40    void
41    Append (const ConstString &path, const ConstString &replacement, bool notify);
42
43    void
44    Clear (bool notify);
45
46    void
47    Dump (Stream *s);
48
49    size_t
50    GetSize ();
51
52    void
53    Insert (const ConstString &path,
54            const ConstString &replacement,
55            uint32_t insert_idx,
56            bool notify);
57
58    bool
59    Remove (off_t index, bool notify);
60
61    bool
62    RemapPath (const ConstString &path, ConstString &new_path);
63
64protected:
65    typedef std::pair <ConstString, ConstString> pair;
66    typedef std::vector <pair> collection;
67    typedef collection::iterator iterator;
68    typedef collection::const_iterator const_iterator;
69
70    collection m_pairs;
71    ChangedCallback m_callback;
72    void * m_callback_baton;
73private:
74    //------------------------------------------------------------------
75    // For PathMappingList only
76    //------------------------------------------------------------------
77    DISALLOW_COPY_AND_ASSIGN (PathMappingList);
78};
79
80} // namespace lldb_private
81
82#endif  // liblldb_PathMappingList_h_
83