File: def_parser.h

package info (click to toggle)
bazel-bootstrap 4.2.3%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 85,476 kB
  • sloc: java: 721,710; sh: 55,859; cpp: 35,359; python: 12,139; xml: 295; objc: 269; makefile: 113; ansic: 106; ruby: 3
file content (44 lines) | stat: -rwxr-xr-x 1,338 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing for details.  */

#ifndef BAZEL_THIRD_PARTY_DEF_PARSER_DEF_PARSER_H
#define BAZEL_THIRD_PARTY_DEF_PARSER_DEF_PARSER_H

#include <set>
#include <stdio.h>
#include <string>

std::wstring AsAbsoluteWindowsPath(const std::string& path);

class DefParser{
 public:
  DefParser() {}

  // This method adds a DEF file.
  // It merges all the symbols found in the DEF file into final result.
  bool AddDefinitionFile(const char* filename);

  // This method adds an Object file.
  // It parses that object file and merge symbols found into final result.
  bool AddObjectFile(const char* filename);

  // Add a file, the function itself will tell which type of file it is.
  bool AddFile(const std::string& filename);

  // Set the DLL name the output DEF file is used for.
  // This will cause a "LIBRARY <DLLName>" entry in the output DEF file.
  void SetDLLName(const std::string& filename);

  // Write all symbols found into the output DEF file.
  void WriteFile(FILE* file);

 private:
  std::set<std::string> Symbols;
  std::set<std::string> DataSymbols;
  std::string DLLName;

  // Returns true if filename ends with .def (case insensitive).
  static bool IsDefFile(const std::string& filename);
};

#endif