| 1 | /* melder_app.cpp |
| 2 | * |
| 3 | * Copyright (C) 2024,2025 Paul Boersma |
| 4 | * |
| 5 | * This code 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 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the 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 work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "melder.h" |
| 20 | |
| 21 | static autostring32 theUpperCaseAppName, theLowerCaseAppName; |
| 22 | void Melder_setAppName (conststring32 appName) { |
| 23 | theUpperCaseAppName = upperCamelCase_STR (appName); |
| 24 | theLowerCaseAppName = lowerSnakeCase_STR (appName); |
| 25 | } |
| 26 | conststring32 Melder_upperCaseAppName() { |
| 27 | return theUpperCaseAppName.get(); |
| 28 | } |
| 29 | conststring32 Melder_lowerCaseAppName() { |
| 30 | return theLowerCaseAppName.get(); |
| 31 | } |
| 32 | |
| 33 | static autostring32 theAppVersionText; |
| 34 | static integer theAppVersionNumber; |
| 35 | void Melder_setAppVersion (conststring32 versionText, integer versionNumber) { |
| 36 | theAppVersionText = Melder_dup (versionText); |
| 37 | theAppVersionNumber = versionNumber; |
| 38 | } |
| 39 | conststring32 Melder_appVersionSTR() { |
| 40 | return theAppVersionText.get(); |
| 41 | } |
| 42 | integer Melder_appVersion() { |
| 43 | return theAppVersionNumber; |
| 44 | } |
| 45 | |
| 46 | static integer theAppYear, theAppMonth, theAppDay; |
| 47 | void Melder_setAppDate (integer year, integer month, integer day) { |
| 48 | theAppYear = year; |
| 49 | theAppMonth = month; |
| 50 | theAppDay = day; |
| 51 | } |
| 52 | integer Melder_appYear() { |
| 53 | return theAppYear; |
| 54 | } |
| 55 | integer Melder_appMonth() { |
| 56 | return theAppMonth; |
| 57 | } |
| 58 | conststring32 Melder_appMonthSTR() { |
| 59 | static conststring32 monthNames [12] = { |
| 60 | U"January", U"February", U"March", U"April", U"May", U"June", |
| 61 | U"July", U"August", U"September", U"October", U"November", U"December" |
| 62 | }; |
| 63 | Melder_assert (theAppMonth > 0 && theAppMonth <= 12); |
| 64 | return monthNames [theAppMonth-1]; |
| 65 | } |
| 66 | integer Melder_appDay() { |
| 67 | return theAppDay; |
| 68 | } |
| 69 | |
| 70 | static autostring32 theAppContactAddress; |
| 71 | void Melder_setAppContactAddress (conststring32 firstPartOfEmailAddress, conststring32 secondPartOfEmailAdress) { |
| 72 | theAppContactAddress = Melder_dup (Melder_cat (firstPartOfEmailAddress, U"@", secondPartOfEmailAdress)); |
| 73 | } |
| 74 | conststring32 Melder_appContactAddress() { |
| 75 | return theAppContactAddress.get(); |
| 76 | } |
| 77 | |
| 78 | /* End of file melder_app.cpp */ |