LLVM  14.0.0git
ArchiveYAML.h
Go to the documentation of this file.
1 //===- ArchiveYAML.h - Archive YAMLIO implementation ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file declares classes for handling the YAML representation of archives.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_OBJECTYAML_ARCHIVEYAML_H
15 #define LLVM_OBJECTYAML_ARCHIVEYAML_H
16 
18 #include "llvm/ObjectYAML/YAML.h"
19 #include "llvm/ADT/MapVector.h"
20 
21 namespace llvm {
22 namespace ArchYAML {
23 
24 struct Archive {
25  struct Child {
26  struct Field {
27  Field() = default;
28  Field(StringRef Default, unsigned Length)
29  : DefaultValue(Default), MaxLength(Length) {}
32  unsigned MaxLength;
33  };
34 
35  Child() {
36  Fields["Name"] = {"", 16};
37  Fields["LastModified"] = {"0", 12};
38  Fields["UID"] = {"0", 6};
39  Fields["GID"] = {"0", 6};
40  Fields["AccessMode"] = {"0", 8};
41  Fields["Size"] = {"0", 10};
42  Fields["Terminator"] = {"`\n", 2};
43  }
44 
46 
49  };
50 
54 };
55 
56 } // end namespace ArchYAML
57 } // end namespace llvm
58 
60 
61 namespace llvm {
62 namespace yaml {
63 
64 template <> struct MappingTraits<ArchYAML::Archive> {
65  static void mapping(IO &IO, ArchYAML::Archive &A);
66  static std::string validate(IO &, ArchYAML::Archive &A);
67 };
68 
69 template <> struct MappingTraits<ArchYAML::Archive::Child> {
70  static void mapping(IO &IO, ArchYAML::Archive::Child &C);
71  static std::string validate(IO &, ArchYAML::Archive::Child &C);
72 };
73 
74 } // end namespace yaml
75 } // end namespace llvm
76 
77 #endif // LLVM_OBJECTYAML_ARCHIVEYAML_H
llvm::ArchYAML::Archive::Child
Definition: ArchiveYAML.h:25
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
MapVector.h
LLVM_YAML_IS_SEQUENCE_VECTOR
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
llvm::Optional
Definition: APInt.h:33
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:37
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:52
llvm::RISCVFeatures::validate
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
Definition: RISCVBaseInfo.cpp:95
llvm::ArchYAML::Archive::Child::Field
Definition: ArchiveYAML.h:26
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::ArchYAML::Archive::Child::PaddingByte
Optional< llvm::yaml::Hex8 > PaddingByte
Definition: ArchiveYAML.h:48
llvm::ArchYAML::Archive::Child::Field::MaxLength
unsigned MaxLength
Definition: ArchiveYAML.h:32
YAML.h
llvm::ArchYAML::Archive
Definition: ArchiveYAML.h:24
llvm::ArchYAML::Archive::Child::Field::Field
Field(StringRef Default, unsigned Length)
Definition: ArchiveYAML.h:28
llvm::ArchYAML::Archive::Content
Optional< yaml::BinaryRef > Content
Definition: ArchiveYAML.h:53
llvm::ArchYAML::Archive::Magic
StringRef Magic
Definition: ArchiveYAML.h:51
YAMLTraits.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::ArchYAML::Archive::Members
Optional< std::vector< Child > > Members
Definition: ArchiveYAML.h:52
llvm::ArchYAML::Archive::Child::Field::DefaultValue
StringRef DefaultValue
Definition: ArchiveYAML.h:31
llvm::ArchYAML::Archive::Child::Field::Field
Field()=default
llvm::ArchYAML::Archive::Child::Fields
MapVector< StringRef, Field > Fields
Definition: ArchiveYAML.h:45
llvm::ArchYAML::Archive::Child::Child
Child()
Definition: ArchiveYAML.h:35
llvm::ArchYAML::Archive::Child::Content
Optional< yaml::BinaryRef > Content
Definition: ArchiveYAML.h:47
llvm::ArchYAML::Archive::Child::Field::Value
StringRef Value
Definition: ArchiveYAML.h:30