-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add bin data model * add lint workflow * Work with DocInfo * add noori test (thanks to hwp.js) * parse ParaShape * add TODO
- Loading branch information
Showing
32 changed files
with
640 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Lint | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: GitHub Action for SwiftLint | ||
uses: norio-nomura/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
excluded: | ||
- Carthage | ||
- Pods | ||
|
||
line_length: 100 | ||
|
||
disabled_rules: | ||
- todo | ||
|
||
type_body_length: | ||
warning: 300 | ||
error: 400 | ||
|
||
file_length: | ||
warning: 500 | ||
error: 1000 | ||
|
||
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown, github-actions-logging) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/**테두리선 종류*/ | ||
public enum HwpBorderType: Int { | ||
/**실선*/ | ||
case line | ||
/**긴 점선*/ | ||
case longDotLine | ||
/**점선*/ | ||
case dotLine | ||
/**-.-.-.-.*/ | ||
/**-..-..-..*/ | ||
/**Dash보다 긴 선분의 반복*/ | ||
/**Dot보다 큰 동그라미의 반복*/ | ||
/**2중선*/ | ||
/**가는선 + 굵은선 2중선*/ | ||
/**굵은선 + 가는선 2중선*/ | ||
/**가는선 + 굵은선 + 가는선 3중선*/ | ||
/**물결*/ | ||
/**물결 2중선*/ | ||
/**두꺼운 3D*/ | ||
/**두꺼운 3D(광원 반대)*/ | ||
/**3D 단선*/ | ||
/**3D 단선(광원 반대)*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public enum HwpStreamName: String { | ||
case fileHeader = "FileHeader" | ||
case docInfo = "DocInfo" | ||
case summary = "\005HwpSummaryInformation" | ||
case previewText = "PrvText" | ||
case previewImage = "PrvImage" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
Sources/HwpKit/Models/Document Properties/HwpCaratLocation.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import Foundation | ||
|
||
public struct HwpCaratLocation: HwpData { | ||
let listId: UInt32 | ||
let paragraphId: UInt32 | ||
let charIndex: UInt32 | ||
public let listId: UInt32 | ||
public let paragraphId: UInt32 | ||
public let charIndex: UInt32 | ||
|
||
init(_ data: Data) { | ||
var reader = DataReader(data) | ||
listId = reader.readUInt32() | ||
paragraphId = reader.readUInt32() | ||
charIndex = reader.readUInt32() | ||
listId = reader.read(UInt32.self) | ||
paragraphId = reader.read(UInt32.self) | ||
charIndex = reader.read(UInt32.self) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import Foundation | ||
|
||
/** | ||
그림, OLE 등의 바이너리 데이터 아이템에 대한 정보 | ||
|
||
Tag ID : HWPTAG_BIN_DATA | ||
*/ | ||
public struct HwpBinData: HwpData { | ||
/**속성 -> type*/ | ||
public let type: HwpBinDataType | ||
|
||
// TODO 속성 파싱 | ||
|
||
/**Type이 "LINK"일 때, 연결 파일의 절대 경로 길이*/ | ||
var absolutePathLength: WORD? | ||
/**Type이 "LINK"일 때, 연결 파일의 절대 경로*/ | ||
public var absolutePath: [WCHAR]? | ||
/**Type이 "LINK"일 때, 연결 파일의 상대 경로 길이*/ | ||
var relativePathLength: WORD? | ||
/**Type이 "LINK"일 때, 연결 파일의 상대 경로*/ | ||
public var relativePath: [WCHAR]? | ||
|
||
/**Type이 "EMBEDDING"이거나 "STORAGE"일 때, BINDATASTORAGE에 저장된 바이너리 데이터의 아이디*/ | ||
public var streamId: UInt16? | ||
/**Type이 "EMBEDDING"일 때, 바이너리 데이터의 형식 이름의 길이*/ | ||
public var extensionLength: WORD? | ||
/** | ||
Type이 "EMBEDDING"일 때 extension("." 제외) | ||
|
||
그림의 경우 jpg, bmp, gif | ||
OLE의 경우 ole | ||
*/ | ||
public var extensionName: [WCHAR]? | ||
|
||
init(_ data: Data) throws { | ||
var reader = DataReader(data) | ||
let property = reader.read(UInt16.self) | ||
type = HwpBinDataType(rawValue: getBitValue(Int(property), 0, 3))! | ||
|
||
if type == HwpBinDataType.link { | ||
absolutePathLength = reader.read(WORD.self) | ||
absolutePath = reader.read(WCHAR.self, Int(absolutePathLength!)) | ||
relativePathLength = reader.read(WORD.self) | ||
relativePath = reader.read(WCHAR.self, Int(relativePathLength!)) | ||
} else { | ||
streamId = reader.read(UInt16.self) | ||
extensionLength = reader.read(WORD.self) | ||
extensionName = reader.read(WCHAR.self, Int(extensionLength!)) | ||
} | ||
} | ||
} | ||
|
||
public enum HwpBinDataType: Int, Codable { | ||
case link = 0x0 | ||
case embedding = 0x1 | ||
case storage = 0x2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Foundation | ||
|
||
public struct HwpBorderFill: HwpData { | ||
public let property: UInt16 | ||
public let borderType: [UInt8] | ||
public let borderThickness: [UInt8] | ||
public let borderColor: [HwpColor] | ||
public let diagonalType: UInt8 | ||
public let diagonalThickness: UInt8 | ||
public let diagonalColor: HwpColor | ||
public let fillInfo: [BYTE] | ||
|
||
init(_ data: Data) throws { | ||
var reader = DataReader(data) | ||
property = reader.read(UInt16.self) | ||
borderType = reader.readBytes(4).bytes | ||
borderThickness = reader.readBytes(4).bytes | ||
borderColor = reader.read(UInt32.self, 4).map {HwpColor($0)} | ||
diagonalType = reader.read(UInt8.self) | ||
diagonalThickness = reader.read(UInt8.self) | ||
diagonalColor = HwpColor(reader.read(UInt32.self)) | ||
fillInfo = reader.readToEnd().bytes | ||
} | ||
} |
Oops, something went wrong.