Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1 KiB

  1. // File.cpp: implementation of the File class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "File.h"
  5. #include <string.h>
  6. #include <stdio.h>
  7. #include "list.h"
  8. #include "String.h"
  9. //////////////////////////////////////////////////////////////////////
  10. // Construction/Destruction
  11. //////////////////////////////////////////////////////////////////////
  12. File::File(TCHAR * f) : Object()
  13. {
  14. fileName = new TCHAR[wcslen(f)+1];
  15. if (f && fileName) wcscpy(fileName,f);
  16. owners = new List();
  17. dependencies = new List();
  18. }
  19. File::~File()
  20. {
  21. delete [] fileName; fileName = 0;
  22. delete owners;owners = 0;
  23. delete dependencies;dependencies = 0;
  24. }
  25. //s - the filename of the dependant to be added
  26. void File::AddDependant(StringNode *s) {
  27. //if it's already there, return
  28. if (owners->Find(s)!=0) {
  29. delete s;
  30. s = 0;
  31. return;
  32. }
  33. //else add it.
  34. owners->Add(s);
  35. return;
  36. }
  37. TCHAR* File::Data() {
  38. return fileName;
  39. }
  40. void File::CheckDependencies() {
  41. }
  42. void File::CloseFile() {
  43. if (hFile!=INVALID_HANDLE_VALUE) CloseHandle(hFile);
  44. hFile = INVALID_HANDLE_VALUE;
  45. }