1 // 2 // The LLVM Compiler Infrastructure 3 // 4 // This file is distributed under the University of Illinois Open Source 5 // License. See LICENSE.TXT for details. 6 // 7 //===---------------------------------------------------------------------===// 8 // 9 // This implements methods defined in ResourceScriptStmt.h. 10 // 11 // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx 12 // 13 //===---------------------------------------------------------------------===// 14 15 #include "ResourceScriptStmt.h" 16 17 namespace llvm { 18 namespace rc { 19 20 raw_ostream &operator<<(raw_ostream &OS, const IntOrString &Item) { 21 if (Item.IsInt) 22 return OS << Item.Data.Int; 23 else 24 return OS << Item.Data.String; 25 } 26 27 raw_ostream &OptionalStmtList::log(raw_ostream &OS) const { 28 for (const auto &Stmt : Statements) { 29 OS << " Option: "; 30 Stmt->log(OS); 31 } 32 return OS; 33 } 34 35 raw_ostream &LanguageResource::log(raw_ostream &OS) const { 36 return OS << "Language: " << Lang << ", Sublanguage: " << SubLang << "\n"; 37 } 38 39 StringRef AcceleratorsResource::Accelerator::OptionsStr 40 [AcceleratorsResource::Accelerator::NumFlags] = { 41 "ASCII", "VIRTKEY", "NOINVERT", "ALT", "SHIFT", "CONTROL"}; 42 43 raw_ostream &AcceleratorsResource::log(raw_ostream &OS) const { 44 OS << "Accelerators (" << ResName << "): \n"; 45 OptStatements.log(OS); 46 for (const auto &Acc : Accelerators) { 47 OS << " Accelerator: " << Acc.Event << " " << Acc.Id; 48 for (size_t i = 0; i < Accelerator::NumFlags; ++i) 49 if (Acc.Flags & (1U << i)) 50 OS << " " << Accelerator::OptionsStr[i]; 51 OS << "\n"; 52 } 53 return OS; 54 } 55 56 raw_ostream &CursorResource::log(raw_ostream &OS) const { 57 return OS << "Cursor (" << ResName << "): " << CursorLoc << "\n"; 58 } 59 60 raw_ostream &IconResource::log(raw_ostream &OS) const { 61 return OS << "Icon (" << ResName << "): " << IconLoc << "\n"; 62 } 63 64 raw_ostream &HTMLResource::log(raw_ostream &OS) const { 65 return OS << "HTML (" << ResName << "): " << HTMLLoc << "\n"; 66 } 67 68 raw_ostream &StringTableResource::log(raw_ostream &OS) const { 69 OS << "StringTable:\n"; 70 OptStatements.log(OS); 71 for (const auto &String : Table) 72 OS << " " << String.first << " => " << String.second << "\n"; 73 return OS; 74 } 75 76 raw_ostream &CharacteristicsStmt::log(raw_ostream &OS) const { 77 return OS << "Characteristics: " << Value << "\n"; 78 } 79 80 raw_ostream &VersionStmt::log(raw_ostream &OS) const { 81 return OS << "Version: " << Value << "\n"; 82 } 83 84 } // namespace rc 85 } // namespace llvm 86