CE Macro.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /******************************************************************************/
  2. #include "stdafx.h"
  3. namespace EE{
  4. namespace Edit{
  5. /******************************************************************************/
  6. Macro& Macro::set(Token &token) {T.name=token; all_up_case=AllUpCase(name); source=token.line->source; line=token.lineIndex(); return T;}
  7. Macro& Macro::set(C Str &name ) {T.name=name ; all_up_case=AllUpCase(name); source=null ; line= -1; return T;}
  8. enum
  9. {
  10. ALL_UP_CASE =1<<0,
  11. USE_FOR_SUGGESTIONS=1<<1,
  12. };
  13. Bool Macro::save(File &f, StrLibrary &sl)C
  14. {
  15. f.putMulti(Byte((all_up_case ? ALL_UP_CASE : 0)|(use_for_suggestions ? USE_FOR_SUGGESTIONS : 0)), params, line).putStr(name).putStr(def);
  16. if(parts.save(f))
  17. {
  18. sl.putStr(f, source ? source->loc.file_name : S);
  19. return f.ok();
  20. }
  21. return false;
  22. }
  23. Bool Macro::load(File &f, StrLibrary &sl, Str &temp)
  24. {
  25. Byte flag;
  26. f.getMulti(flag, params, line).getStr(name).getStr(def);
  27. all_up_case =FlagTest(flag, ALL_UP_CASE);
  28. use_for_suggestions=FlagTest(flag, USE_FOR_SUGGESTIONS);
  29. if(parts.load(f))
  30. {
  31. sl.getStr(f, temp); source=CE.findSource(temp);
  32. if(f.ok())return true;
  33. }
  34. /*del();*/ return false;
  35. }
  36. /******************************************************************************/
  37. }}
  38. /******************************************************************************/