ardour
export_filename.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 Paul Davis
3  Author: Sakari Bergen
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __ardour_export_filename_h__
22 #define __ardour_export_filename_h__
23 
24 #include <boost/shared_ptr.hpp>
25 
26 #include <string>
27 
28 #include <ardour/export_pointers.h>
29 
31 
32 namespace ARDOUR
33 {
34 
35 class Session;
36 
38  public:
39 
40  enum DateFormat {
42  D_ISO, // ISO 8601 full date
43  D_ISOShortY, // Like ISO 8601, but short year representation
44  D_BE, // big endian (no deliminator)
45  D_BEShortY // big endian short year representation
46  };
47 
48  enum TimeFormat {
51  T_Delim
52  };
53 
54  private:
55  friend class ExportElementFactory;
56  ExportFilename (Session & session);
57 
58  public:
59  /* Serialization */
60 
61  XMLNode & get_state ();
62  int set_state (const XMLNode &);
63 
64  /* data access */
65 
66  std::string get_path (ExportFormatSpecPtr format) const;
67  std::string get_folder () const { return folder; }
68 
69  TimeFormat get_time_format () const { return time_format; }
70  DateFormat get_date_format () const { return date_format; }
71  std::string get_time_format_str (TimeFormat format) const;
72  std::string get_date_format_str (DateFormat format) const;
73 
74  std::string get_label () const { return label; }
75  uint32_t get_revision () const { return revision; }
76 
77  /* data modification */
78 
79  void set_time_format (TimeFormat format);
80  void set_date_format (DateFormat format);
81  void set_label (std::string value);
82  void set_revision (uint32_t value) { revision = value; }
83  void set_channel (uint32_t value) { channel = value; }
84  bool set_folder (std::string path);
85 
86  void set_timespan (ExportTimespanPtr ts) { timespan = ts; }
87  void set_channel_config (ExportChannelConfigPtr cc) { channel_config = cc; }
88 
89  /* public members */
90 
100 
101  private:
102 
104 
105  std::string label;
106  uint32_t revision;
107  uint32_t channel;
108 
109  std::string folder;
110 
113 
114  std::string get_formatted_time (std::string const & format) const;
115  // Due to the static allocation used in strftime(), no destructor or copy-ctor is needed for this
116  struct tm * time_struct;
117 
120 
121  /* Serialization helpers */
122 
123  typedef std::pair<bool, std::string> FieldPair;
124 
125  void add_field (XMLNode * node, std::string const & name, bool enabled, std::string const & value = "");
126  FieldPair get_field (XMLNode const & node, std::string const & name);
127  FieldPair analyse_folder ();
128 };
129 
130 
131 } // namespace ARDOUR
132 
133 #endif /* __ardour_export_filename_h__ */
void set_channel(uint32_t value)
std::string get_label() const
LIBARDOUR_API const char * revision
Definition: revision.cc:2
std::string get_folder() const
ExportChannelConfigPtr channel_config
Definition: amp.h:29
void set_channel_config(ExportChannelConfigPtr cc)
ExportTimespanPtr timespan
TimeFormat get_time_format() const
uint32_t get_revision() const
void set_revision(uint32_t value)
void set_timespan(ExportTimespanPtr ts)
#define LIBARDOUR_API
const char * name
Definition: xml++.h:95
DateFormat get_date_format() const
std::pair< bool, std::string > FieldPair