cfg.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 2004-06 Simone Rota <sip@varlock.com>
  3. Copyright (C) 2004-06 Johannes Winkelmann <jw@tks6.net>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. */
  9. #ifndef _CFG_H_
  10. #define _CFG_H_
  11. #include <string>
  12. #include <map>
  13. #include <vector>
  14. #define INPUT_MAXLENGTH_NAME 30
  15. #define INPUT_MAXLENGTH_PASSWD 50
  16. #define CFGFILE SYSCONFDIR"/slim.conf"
  17. #define THEMESDIR PKGDATADIR"/themes"
  18. #define THEMESFILE "/slim.theme"
  19. using namespace std;
  20. class Cfg {
  21. public:
  22. Cfg();
  23. ~Cfg();
  24. bool readConf(string configfile);
  25. string parseOption(string line, string option);
  26. const string& getError() const;
  27. string& getOption(string option);
  28. string getWelcomeMessage();
  29. static int absolutepos(const string& position, int max, int width);
  30. static int string2int(const char* string, bool* ok = 0);
  31. static void split(vector<string>& v, const string& str, char c);
  32. static string Trim(const string& s);
  33. string nextSession(string current);
  34. private:
  35. map<string,string> options;
  36. string error;
  37. };
  38. #endif