25 #include "cluster.h" |
25 #include "cluster.h" |
26 #include "longentry.h" |
26 #include "longentry.h" |
27 |
27 |
28 #define ToString(dataInteger) reinterpret_cast<char*>(&dataInteger),sizeof(dataInteger) |
28 #define ToString(dataInteger) reinterpret_cast<char*>(&dataInteger),sizeof(dataInteger) |
29 |
29 |
30 typedef std::stack<CLongEntry*> LongEntryStack; |
30 typedef stack<CLongEntry*> LongEntryStack; |
31 typedef std::list<String> StringList; |
31 typedef list<string> StringList; |
32 |
32 |
33 //Long entry sub name lengths |
33 //Long entry sub name lengths |
34 enum TLongSubNameLength |
34 enum TLongSubNameLength |
35 { |
35 { |
36 ESubName1Length = 5, |
36 ESubName1Length = 5, |
62 private: |
62 private: |
63 StringList iSubNamesList; //Holds the splitted file names |
63 StringList iSubNamesList; //Holds the splitted file names |
64 LongEntryStack iLongEntryStack; //Holds all the long name directory entry node's |
64 LongEntryStack iLongEntryStack; //Holds all the long name directory entry node's |
65 unsigned int iClusterNumber; //Current cluster number, where the current long entry needs to be written |
65 unsigned int iClusterNumber; //Current cluster number, where the current long entry needs to be written |
66 CCluster* iClusterPtr; |
66 CCluster* iClusterPtr; |
67 String iLongName; |
67 string iLongName; |
68 char iLongEntryAttribute; |
68 char iLongEntryAttribute; |
69 String iShortName; |
69 string iShortName; |
70 unsigned int iLongNameLength; |
70 unsigned int iLongNameLength; |
71 unsigned int iTildeNumberPosition; |
71 unsigned int iTildeNumberPosition; |
72 /**If the received sub name entry size is equal to its expected length, then |
72 /**If the received sub name entry size is equal to its expected length, then |
73 two NULL character should be preceded at the start of next sub name |
73 two NULL character should be preceded at the start of next sub name |
74 */ |
74 */ |
75 bool iSubNameProperEnd; //Is name ends without NULL character termination? |
75 bool iSubNameProperEnd; //Is name ends without NULL character termination? |
76 bool iFirstNullName;// Is first name ending with NULL character? |
76 bool iFirstNullName;// Is first name ending with NULL character? |
77 |
77 |
78 private: |
78 private: |
79 String GetShortEntryName(); |
79 string GetShortEntryName(); |
80 unsigned char CalculateCheckSum(); |
80 unsigned char CalculateCheckSum(); |
81 void WriteLongEntry(CLongEntry* aLongEntry,String& longEntryString); |
81 void WriteLongEntry(CLongEntry* aLongEntry,string& longEntryString); |
82 void WriteSubName(String& aSubName,unsigned short aSubNameLength, |
82 void WriteSubName(string& aSubName,unsigned short aSubNameLength, |
83 String& alongEntryString); |
83 string& alongEntryString); |
84 void FormatLongFileName(String& aLongName); |
84 void FormatLongFileName(string& aLongName); |
85 void CheckAndUpdateShortName(String& aShortName); |
85 void CheckAndUpdateShortName(string& aShortName); |
86 void PushAndErase(String& aFirstName,String& aSecondName,String& aThirdName); |
86 void PushAndErase(string& aFirstName,string& aSecondName,string& aThirdName); |
87 void GetSubName(String& aLongName, |
87 void GetSubName(string& aLongName, |
88 int& aStartIndex, |
88 int& aStartIndex, |
89 int& aStringLength, |
89 int& aStringLength, |
90 int aSubNameLength, |
90 int aSubNameLength, |
91 String& aSubName); |
91 string& aSubName); |
92 void PopAndErase(); |
92 void PopAndErase(); |
93 void CalculateExtentionLength(); |
93 void CalculateExtentionLength(); |
94 |
94 |
95 public: |
95 public: |
96 ClongName(CCluster* aClusterPtr, CDirectory* aEntry); |
96 ClongName(CCluster* aClusterPtr, CDirectory* aEntry); |
97 ~ClongName(); |
97 ~ClongName(); |
98 CDirectory* CreateShortEntry(CDirectory* aEntry); |
98 CDirectory* CreateShortEntry(CDirectory* aEntry); |
99 String CreateLongEntries(); |
99 string CreateLongEntries(); |
100 static void DestroyShortEntryList(); |
100 static void DestroyShortEntryList(); |
101 }; |
101 }; |
102 |
102 |
103 #endif //LONGNAME_H |
103 #endif //LONGNAME_H |