Ardour  9.0-pre0-582-g084a23a80d
export_filename.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009 David Robillard <d@drobilla.net>
4  * Copyright (C) 2010-2013 Sakari Bergen <sakari.bergen@beatwaves.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #pragma once
22 
23 #include <memory>
24 #include <string>
25 
26 #include <ardour/export_pointers.h>
27 
29 
30 namespace ARDOUR
31 {
32 
33 class Session;
34 
36  public:
37 
38  enum DateFormat {
40  D_ISO, // ISO 8601 full date
41  D_ISOShortY, // Like ISO 8601, but short year representation
42  D_BE, // big endian (no deliminator)
43  D_BEShortY // big endian short year representation
44  };
45 
46  enum TimeFormat {
49  T_Delim
50  };
51 
52  private:
53  friend class ExportElementFactory;
55 
56  public:
57  /* Serialization */
58 
59  XMLNode & get_state () const;
60  int set_state (const XMLNode &);
61 
62  /* data access */
63 
64  std::string get_path (ExportFormatSpecPtr format) const;
65  std::string get_folder () const { return folder; }
66 
67  TimeFormat get_time_format () const { return time_format; }
68  DateFormat get_date_format () const { return date_format; }
69  std::string get_time_format_str (TimeFormat format) const;
70  std::string get_date_format_str (DateFormat format) const;
71 
72  std::string get_label () const { return label; }
73  uint32_t get_revision () const { return revision; }
74 
75  /* data modification */
76 
77  void set_time_format (TimeFormat format);
78  void set_date_format (DateFormat format);
79  void set_label (std::string value);
80  void set_revision (uint32_t value) { revision = value; }
81  void set_channel (uint32_t value) { channel = value; }
82  bool set_folder (std::string path);
83 
84  void set_timespan (ExportTimespanPtr ts) { timespan = ts; }
85  void set_channel_config (ExportChannelConfigPtr cc) { channel_config = cc; }
86 
87  /* public members */
88 
99 
100  private:
101 
103 
104  std::string label;
105  uint32_t revision;
106  uint32_t channel;
107 
108  std::string folder;
109 
112 
113  std::string get_formatted_time (std::string const & format) const;
114  struct tm time_struct;
115 
118 
119  /* Serialization helpers */
120 
121  typedef std::pair<bool, std::string> FieldPair;
122 
123  static void add_field (XMLNode * node, std::string const & name, bool enabled, std::string const & value = "");
124  FieldPair get_field (XMLNode const & node, std::string const & name);
126 };
127 
128 
129 } // namespace ARDOUR
130 
std::string get_formatted_time(std::string const &format) const
bool set_folder(std::string path)
std::string get_date_format_str(DateFormat format) const
FieldPair analyse_folder() const
std::string get_label() const
std::string get_path(ExportFormatSpecPtr format) const
ExportFilename(Session &session)
void set_time_format(TimeFormat format)
FieldPair get_field(XMLNode const &node, std::string const &name)
int set_state(const XMLNode &)
void set_channel(uint32_t value)
ExportChannelConfigPtr channel_config
std::string get_time_format_str(TimeFormat format) const
static void add_field(XMLNode *node, std::string const &name, bool enabled, std::string const &value="")
std::string get_folder() const
DateFormat get_date_format() const
void set_timespan(ExportTimespanPtr ts)
void set_label(std::string value)
TimeFormat get_time_format() const
ExportTimespanPtr timespan
XMLNode & get_state() const
void set_channel_config(ExportChannelConfigPtr cc)
void set_date_format(DateFormat format)
void set_revision(uint32_t value)
std::pair< bool, std::string > FieldPair
uint32_t get_revision() const
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
std::shared_ptr< ExportChannelConfiguration > ExportChannelConfigPtr
const char * revision
std::shared_ptr< ExportFormatSpecification > ExportFormatSpecPtr