Atoms Crowd  7.0.0
PathSolver.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsUtils/Globals.h>
11 #include <string>
12 #include <vector>
13 
14 namespace AtomsUtils
15 {
16  class ATOMSUTILS_EXPORT PathSolverFilter
17  {
18  public:
19 
20  PathSolverFilter(const std::string& name);
21 
22  virtual ~PathSolverFilter();
23 
24  virtual bool validate(const std::string& path) const;
25 
26  virtual std::string solve(const std::string& path)const ;
27 
28  virtual std::string name() const;
29 
30  private:
31 
32  std::string m_name;
33  };
34 
35  class ATOMSUTILS_EXPORT PathSolver
36  {
37  public:
38 
39  typedef std::vector<AtomsPtr<PathSolverFilter>> SolverMap;
40 
41  static PathSolver& instance();
42 
43  std::string solvePath(const std::string& path) const;
44 
45  const SolverMap& solvers() const;
46 
47  void insertSolver(AtomsPtr<PathSolverFilter>& solver, int position = -1);
48 
49  void removeSolver(const std::string& name);
50 
51  int findSolver(const std::string& name) const;
52 
53  AtomsPtr<PathSolverFilter> solver(unsigned int position);
54 
55  unsigned int numSolvers();
56 
57  private:
58 
60  PathSolver();
61 
63  PathSolver(const PathSolver&);
64 
66  ~PathSolver();
67 
69  PathSolver& operator=(const PathSolver&);
70 
71 
72  private:
73 
74  SolverMap m_solvers;
75 
76  };
77 
78  ATOMSUTILS_EXPORT std::string solvePath(const std::string& path);
79 
80 }
Definition: PathSolver.h:17
Definition: PathSolver.h:36
AtomsCore namespace.
Definition: Base64.h:13