Audacity 3.2.0
Namespaces | Classes | Typedefs | Functions | Variables
audacity Namespace Reference

Namespaces

namespace  anonymous_namespace{Uuid.cpp}
 
namespace  cloud
 
namespace  concurrency
 
namespace  network_manager
 
namespace  sentry
 
namespace  sqlite
 

Classes

struct  ApplicationSettings
 Provides an access to application-wise settings. More...
 
class  BasicSettings
 Base class for objects that provide facility to store data persistently, and access it with string keys that are formed similarly to how paths in tree are formed. More...
 
struct  GoldenRatio
 
struct  GoldenRatio< 4 >
 
struct  GoldenRatio< 8 >
 
class  TypedAny
 Generates distinct, non-interconvertible types wrapping std::any. More...
 
class  Uuid
 Utility class that generates and parses UUIDs. More...
 

Typedefs

using SystemTime = std::chrono::system_clock::time_point
 

Functions

std::string ToUTF8 (const std::wstring &wstr)
 
std::string ToUTF8 (const wchar_t *wstr)
 
std::string ToUTF8 (const wxString &wstr)
 
std::wstring ToWString (const std::string &str)
 
STRING_UTILS_API std::wstring ToWString (std::string_view str)
 
std::wstring ToWString (const char *str)
 
std::wstring ToWString (const wxString &str)
 
wxString ToWXString (const std::string &str)
 
STRING_UTILS_API wxString ToWXString (std::string_view str)
 
STRING_UTILS_API wxString ToWXString (const char *str)
 
wxString ToWXString (const std::wstring &str)
 
wxString ToWXString (std::wstring_view str)
 
wxString ToWXString (const wchar_t *str)
 
bool ParseRFC822Date (const std::string &dateString, SystemTime *time)
 
bool ParseISO8601Date (const std::string &dateString, SystemTime *time)
 
std::string SerializeRFC822Date (SystemTime timePoint)
 
uint8_t HexCharToNum (char c) noexcept
 
std::string UrlDecode (const std::string &url)
 
std::string UrlEncode (const std::string &url)
 
template<typename Tag >
void swap (TypedAny< Tag > &x, TypedAny< Tag > &y)
 Non-member swap. More...
 

Variables

constexpr int BRACED_UUID_LENGTH = 38
 
constexpr int UUID_LENGTH = 36
 
constexpr int HEX_UUID_LENGTH = 32
 

Detailed Description


Audacity: A Digital Audio Editor

BasicSettings.h

Vitaly Sverchinsky

Typedef Documentation

◆ SystemTime

using audacity::SystemTime = typedef std::chrono::system_clock::time_point

Definition at line 19 of file DateTimeConversions.h.

Function Documentation

◆ HexCharToNum()

uint8_t audacity::HexCharToNum ( char  c)
inlinenoexcept

Definition at line 20 of file HexHelpers.h.

21{
22 assert (std::isxdigit (c) != 0);
23
24 if ('0' <= c && c <= '9')
25 return c - '0';
26 else if ('A' <= c && c <= 'F')
27 return c - 'A' + 10;
28 else if ('a' <= c && c <= 'f')
29 return c - 'a' + 10;
30
31 return 0;
32}

Referenced by audacity::anonymous_namespace{Uuid.cpp}::readByte(), and UrlDecode().

Here is the caller graph for this function:

◆ ParseISO8601Date()

STRING_UTILS_API bool audacity::ParseISO8601Date ( const std::string &  dateString,
SystemTime time 
)

Definition at line 34 of file DateTimeConversions.cpp.

35{
36 wxDateTime dt;
37
38 wxString::const_iterator end;
39 const wxString fmt = wxS("%Y%m%dT%H%M%SZ");
40
41 if (!dt.ParseFormat(dateString, fmt, &end))
42 return false;
43
44 if (time != nullptr)
45 *time = std::chrono::system_clock::from_time_t (dt.GetTicks ());
46
47 return true;
48}
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References details::end().

Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::IsUrlExpired().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ParseRFC822Date()

STRING_UTILS_API bool audacity::ParseRFC822Date ( const std::string &  dateString,
SystemTime time 
)

Definition at line 20 of file DateTimeConversions.cpp.

21{
22 wxDateTime dt;
23 wxString::const_iterator end;
24
25 if (!dt.ParseRfc822Date (dateString, &end))
26 return false;
27
28 if (time != nullptr)
29 *time = std::chrono::system_clock::from_time_t (dt.GetTicks ());
30
31 return true;
32}

References details::end().

Referenced by audacity::network_manager::Cookie::Parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SerializeRFC822Date()

STRING_UTILS_API std::string audacity::SerializeRFC822Date ( SystemTime  timePoint)

Definition at line 50 of file DateTimeConversions.cpp.

51{
52 const wxDateTime dt (
53 time_t (std::chrono::duration_cast<std::chrono::seconds> (
54 timePoint.time_since_epoch ()
55 ).count ()));
56
57 return ToUTF8 (dt.Format("%a, %d %b %Y %H:%M:%S %z"));
58}
std::string ToUTF8(const std::wstring &wstr)

References ToUTF8().

Referenced by audacity::network_manager::Cookie::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swap()

template<typename Tag >
void audacity::swap ( TypedAny< Tag > &  x,
TypedAny< Tag > &  y 
)
inline

Non-member swap.

Definition at line 89 of file TypedAny.h.

89{ x.swap(y); }
void swap(TypedAny &other) noexcept
Definition: TypedAny.h:62

References audacity::TypedAny< Tag >::swap().

Here is the call graph for this function:

◆ ToUTF8() [1/3]

STRING_UTILS_API std::string audacity::ToUTF8 ( const std::wstring &  wstr)

Definition at line 19 of file CodeConversions.cpp.

20{
21 return std::wstring_convert<std::codecvt_utf8<wchar_t>> ().to_bytes (wstr);
22}

Referenced by audacity::sentry::anonymous_namespace{SentryReport.cpp}::AddOSContext(), audacity::cloud::audiocom::OAuthService::AuthoriseRefreshToken(), audacity::cloud::audiocom::UserService::DownloadAvatar(), ErrorReportDialog::ErrorReportDialog(), ExportFFmpegOptions::ExportFFmpegOptions(), ExportFFmpegOptions::FetchCompatibleFormatList(), audacity::cloud::audiocom::sync::anonymous_namespace{MixdownUploader.cpp}::GenerateTempPath(), audacity::cloud::audiocom::ServiceConfig::GetAudioURL(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectPage(), audacity::cloud::audiocom::ServiceConfig::GetFinishUploadPage(), audacity::cloud::audiocom::ServiceConfig::GetOAuthLoginPage(), audacity::cloud::audiocom::sync::CloudProjectPropertiesDialog::GetProjectName(), audacity::cloud::audiocom::ServiceConfig::GetProjectPagePath(), audacity::cloud::audiocom::ServiceConfig::GetProjectsPagePath(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::GetSelectedProjectUrl(), audacity::cloud::audiocom::anonymous_namespace{UploadService.cpp}::GetUploadRequestPayload(), anonymous_namespace{AudacityApp.cpp}::InitCrashreports(), anonymous_namespace{ExportFFmpeg.cpp}::ExportOptionsFFmpegCustomEditor::Load(), LV2EffectBase::LoadFactoryPreset(), audacity::cloud::audiocom::sync::MakeClientFailure(), audacity::cloud::audiocom::sync::ProjectCloudExtension::MarkProjectSynced(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::OnBlockDownloaded(), audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), audacity::cloud::audiocom::LinkWithTokenDialog::OnContinue(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::OnProjectBlobDownloaded(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnSave(), ErrorReportDialog::OnSend(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSnapshotCreated(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncCompleted(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnUpdateSaved(), audacity::cloud::audiocom::sync::CloudProjectsDatabase::OpenConnection(), ProjectFileManager::OpenProjectFile(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::PerformCloudSave(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::SaveCloudProject(), SerializeRFC822Date(), audacity::cloud::audiocom::ServiceConfig::ServiceConfig(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::SetupBlocksCopy(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::Sync(), audacity::cloud::audiocom::CloudSyncService::SyncCloudSnapshot(), ToLower(), ToUpper(), audacity::cloud::audiocom::sync::ProjectCloudExtension::UpdateIdFromDatabase(), audacity::network_manager::anonymous_namespace{CurlHandleManager.cpp}::CurlConfig::UpdatePrefs(), audacity::cloud::audiocom::sync::DataUploader::Upload(), audacity::cloud::audiocom::sync::anonymous_namespace{ResumedSnaphotUploadOperation.cpp}::ResumedSnaphotUploadOperation::UploadBlocks(), and OpusExportProcessor::WriteTags().

Here is the caller graph for this function:

◆ ToUTF8() [2/3]

STRING_UTILS_API std::string audacity::ToUTF8 ( const wchar_t *  wstr)

Definition at line 24 of file CodeConversions.cpp.

25{
26 return std::wstring_convert<std::codecvt_utf8<wchar_t>> ().to_bytes (wstr);
27}

◆ ToUTF8() [3/3]

STRING_UTILS_API std::string audacity::ToUTF8 ( const wxString &  wstr)

Definition at line 29 of file CodeConversions.cpp.

30{
31 return wstr.ToStdString (wxGet_wxConvUTF8 ());
32}

◆ ToWString() [1/4]

STRING_UTILS_API std::wstring audacity::ToWString ( const char *  str)

Definition at line 45 of file CodeConversions.cpp.

46{
47 return std::wstring_convert<std::codecvt_utf8<wchar_t>> ().from_bytes (str);
48}
#define str(a)

References str.

◆ ToWString() [2/4]

STRING_UTILS_API std::wstring audacity::ToWString ( const std::string &  str)

Definition at line 34 of file CodeConversions.cpp.

35{
36 return std::wstring_convert<std::codecvt_utf8<wchar_t>> ().from_bytes (str);
37}

References str.

Referenced by audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), ProjectFileIO::ShowError(), ToLower(), and ToUpper().

Here is the caller graph for this function:

◆ ToWString() [3/4]

STRING_UTILS_API std::wstring audacity::ToWString ( const wxString &  str)

Definition at line 50 of file CodeConversions.cpp.

51{
52 return str.ToStdWstring ();
53}

References str.

◆ ToWString() [4/4]

STRING_UTILS_API std::wstring audacity::ToWString ( std::string_view  str)

Definition at line 39 of file CodeConversions.cpp.

40{
41 return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(
42 str.data(), str.data() + str.length());
43}

References str.

◆ ToWXString() [1/6]

STRING_UTILS_API wxString audacity::ToWXString ( const char *  str)

Definition at line 65 of file CodeConversions.cpp.

66{
67 return wxString::FromUTF8(str);
68}

References str.

◆ ToWXString() [2/6]

STRING_UTILS_API wxString audacity::ToWXString ( const std::string &  str)

Definition at line 55 of file CodeConversions.cpp.

56{
57 return wxString::FromUTF8 (str);
58}

References str.

Referenced by audacity::cloud::audiocom::sync::MixdownUploader::ExportProject(), anonymous_namespace{ImportMP3_MPG123.cpp}::GetId3v2Genre(), audacity::cloud::audiocom::CloudSyncService::GetProjectState(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::GetValue(), OpusImportFileHandle::Import(), WavPackImportFileHandle::Import(), audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), audacity::cloud::audiocom::UserPanel::OnLinkButtonPressed(), audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpen(), audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpenAudioCom(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnUpdateSaved(), audacity::cloud::audiocom::sync::OpenProjectFromCloud(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncHousekeeper.cpp}::Housekeeper::PerformHousekeeping(), anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::ReadTags(), ProjectFileManager::Save(), audacity::cloud::audiocom::CloudSyncService::SyncCloudSnapshot(), ToLower(), ToUpper(), audacity::sentry::AnonymizedMessage::ToWXString(), audacity::cloud::audiocom::UserService::UpdateUserData(), and audacity::cloud::audiocom::sync::DataUploader::Upload().

Here is the caller graph for this function:

◆ ToWXString() [3/6]

STRING_UTILS_API wxString audacity::ToWXString ( const std::wstring &  str)

Definition at line 70 of file CodeConversions.cpp.

71{
72 return wxString (str);
73}

References str.

◆ ToWXString() [4/6]

STRING_UTILS_API wxString audacity::ToWXString ( const wchar_t *  str)

Definition at line 80 of file CodeConversions.cpp.

81{
82 return wxString(str);
83}

References str.

◆ ToWXString() [5/6]

STRING_UTILS_API wxString audacity::ToWXString ( std::string_view  str)

Definition at line 60 of file CodeConversions.cpp.

61{
62 return wxString::FromUTF8(str.data(), str.length());
63}

References str.

◆ ToWXString() [6/6]

STRING_UTILS_API wxString audacity::ToWXString ( std::wstring_view  str)

Definition at line 75 of file CodeConversions.cpp.

76{
77 return wxString(str.data(), str.size());
78}

References str.

◆ UrlDecode()

STRING_UTILS_API std::string audacity::UrlDecode ( const std::string &  url)

Definition at line 18 of file UrlDecode.cpp.

19{
20 std::string result;
21
22 const size_t length = url.length ();
23
24 for (auto it = url.begin (), end = url.end (); it != end; ++it)
25 {
26 const char c = *it;
27
28 if (c != '%')
29 {
30 result.push_back (c);
31 }
32 else
33 {
34 if (++it == url.end ())
35 break; // Malformed input string
36
37 const char c1 = *it;
38
39 if (++it == url.end ())
40 break; // Malformed input string
41
42 const char c2 = *it;
43
44 result.push_back (HexCharToNum (c1) << 4 | HexCharToNum (c2));
45 }
46 }
47
48 return result;
49}
uint8_t HexCharToNum(char c) noexcept
Definition: HexHelpers.h:20

References details::end(), and HexCharToNum().

Referenced by audacity::cloud::audiocom::OAuthService::HandleLinkURI().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UrlEncode()

STRING_UTILS_API std::string audacity::UrlEncode ( const std::string &  url)

Definition at line 16 of file UrlEncode.cpp.

17{
18 std::string escaped;
19
20 for (char c : url)
21 {
22 if (('0' <= c && c <= '9') ||
23 ('A' <= c && c <= 'Z') ||
24 ('a' <= c && c <= 'z') ||
25 (c == '~' || c == '-' || c == '_' || c == '.')
26 )
27 {
28 escaped.push_back (c);
29 }
30 else
31 {
32 static const char symbolLookup[] = "0123456789ABCDEF";
33
34 escaped.push_back ('%');
35
36 escaped.push_back (symbolLookup[(c & 0xF0) >> 4]);
37 escaped.push_back (symbolLookup[(c & 0x0F) >> 0]);
38 }
39 }
40
41 return escaped;
42}

Variable Documentation

◆ BRACED_UUID_LENGTH

constexpr int audacity::BRACED_UUID_LENGTH = 38
constexpr

Definition at line 38 of file Uuid.cpp.

Referenced by audacity::Uuid::FromString().

◆ HEX_UUID_LENGTH

constexpr int audacity::HEX_UUID_LENGTH = 32
constexpr

Definition at line 40 of file Uuid.cpp.

Referenced by audacity::Uuid::ToHexString().

◆ UUID_LENGTH

constexpr int audacity::UUID_LENGTH = 36
constexpr

Definition at line 39 of file Uuid.cpp.

Referenced by audacity::Uuid::FromString(), and audacity::Uuid::ToString().