cfg.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 2004-05 Simone Rota <sip@varlock.com>
  3. Copyright (C) 2004-05 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. bool readConf(string configfile);
  24. string parseOption(string line, string option);
  25. const string& getError() const;
  26. string& getOption(string option);
  27. string getWelcomeMessage();
  28. static int absolutepos(const string& position, int max, int width);
  29. static int string2int(const char* string, bool* ok = 0);
  30. static void split(vector<string>& v, const string& str, char c);
  31. static string Trim(const string& s);
  32. string nextSession(string current);
  33. private:
  34. map<string,string> options;
  35. string error;
  36. };
  37. #endif