-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parse symbols using qds embedded method
- Loading branch information
Showing
4 changed files
with
60 additions
and
40 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
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,22 @@ | ||
// | ||
// NativeSymbolParser.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 17.11.23. | ||
// | ||
|
||
import Foundation | ||
@_implementationOnly import graal_api | ||
|
||
class NativeSymbolParser { | ||
func parse(_ symbols: String) throws -> [String] { | ||
let thread = currentThread() | ||
let symbols = try ErrorCheck.nativeCall(thread, dxfg_Tools_parseSymbols(thread, symbols.toCStringRef())) | ||
var result = [String]() | ||
for index in 0..<Int(symbols.pointee.size) { | ||
result.append(String(pointee: symbols.pointee.elements[index])) | ||
} | ||
try ErrorCheck.nativeCall(thread, dxfg_CList_String_release(thread, symbols)) | ||
return result | ||
} | ||
} |
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,21 @@ | ||
// | ||
// SymbolParser.swift | ||
// DXFeedFramework | ||
// | ||
// Created by Aleksey Kosylo on 17.11.23. | ||
// | ||
|
||
import Foundation | ||
|
||
public class SymbolParser { | ||
/// It returs list of symbols. | ||
/// | ||
/// You can use input like this | ||
/// "ipf[https://demo:[email protected]/ipf?TYPE=STOCK&compression=zip],APPL" | ||
/// It will download symbols from ipf endpoint. | ||
/// - Throws: GraalException. Rethrows exception from Java. | ||
public static func parse(_ symbols: String) throws -> [String] { | ||
let nativeParser = NativeSymbolParser() | ||
return try nativeParser.parse(symbols) | ||
} | ||
} |
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