Skip to content

Commit

Permalink
Merge pull request #31 from sbcgua/restructure + v2.4.0
Browse files Browse the repository at this point in the history
Restructure
  • Loading branch information
sbcgua authored Jan 22, 2025
2 parents 3f2955e + 0211744 commit 71791d3
Show file tree
Hide file tree
Showing 32 changed files with 56 additions and 119 deletions.
8 changes: 3 additions & 5 deletions .abapgit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<NAME>Text2tab</NAME>
<MASTER_LANGUAGE>E</MASTER_LANGUAGE>
<STARTING_FOLDER>/src/</STARTING_FOLDER>
<FOLDER_LOGIC>PREFIX</FOLDER_LOGIC>
<IGNORE>
<item>/.gitignore</item>
<item>/LICENSE</item>
<item>/.travis.yml</item>
<item>/-.travis.yml</item>
<item>/changelog.txt</item>
<item>/abaplint.json</item>
<item>/abaplint.jsonc</item>
<item>/README.md</item>
<item>/CONTRIBUTING.md</item>
<item>/ci/</item>
<item>/deploy-key.enc</item>
</IGNORE>
<VERSION_CONSTANT>ZIF_TEXT2TAB=&gt;VERSION</VERSION_CONSTANT>
</DATA>
</asx:values>
</asx:abap>
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ABAP text2tab parser and serializer (ex. Abap data parser)

![abaplint](https://github.com/sbcgua/text2tab/workflows/abaplint/badge.svg)
![Version](https://img.shields.io/github/v/tag/sbcgua/abap_data_parser.svg)
![Version](https://img.shields.io/github/v/tag/sbcgua/text2tab.svg)

TAB-delimited text parser and serializer for ABAP
*[changelog](./changelog.txt)*
Expand Down Expand Up @@ -30,10 +30,12 @@ The package also contains 2 **examples**:

## Installation

You can install the whole code using [abapGit](https://github.com/larshp/abapGit) tool (recommended way). Alternatively, you can also copy content of `*.clas.abap` to your program (please keep the homepage reference and license text).
You can install the whole code using [abapGit](https://github.com/abapGit/abapGit) tool.

The tool is open source and distributed under MIT license. It was initially created as a part of another project - [mockup loader](https://github.com/sbcgua/mockup_loader) - but then separated as an independent multi-usage tool.

The package contains 2 subpackages: `core` (the tool itself) and `examples` (example programs). The latter can be skipped for the deserialization (abapGit supports filename filtering - specify `*/examples/*` in the corresponding repo setting).

## Example of usage

Source text file (CRLF as a line delimiter, TAB as a field delimiter)
Expand Down Expand Up @@ -391,7 +393,7 @@ This is supported in parser only at the moment. Serializer does not produce many

## Checking version

`zif_text2tab_constants` has the `version` attribute. And there is a helper method `check_version_fits` to check if the text2tab package has the minimal required version.
`zif_text2tab` has the `version` attribute. And there is a helper method `check_version_fits` to check if the text2tab package has the minimal required version. To extract the current version prefer `zcl_text2tab_parser=>version( )` method.

```abap
* Assuming version is 2.1.0
Expand Down
7 changes: 6 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ Legend
+ : added
- : removed

v2.3.5, 2023-07-??
v2.4.0, 2025-01-22
------------------
! BREAKING: version constant was moved zif_text2tab. zif_text2tab_constants is deleted.
! Restructured packages: core objects were separated from examples, to improve deployment (abapGit supports skipping packages, so examples package can be left out of the real system)

v2.3.5, 2023-07-11
------------------
* code and type cleanups
+ possibility to keep fields_only order during serialization #25
Expand Down
53 changes: 0 additions & 53 deletions package-lock.json

This file was deleted.

26 changes: 0 additions & 26 deletions package.json

This file was deleted.

10 changes: 10 additions & 0 deletions src/core/package.devc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>TEXT2TAB serializer/deserializer: core objects</CTEXT>
</DEVC>
</asx:values>
</asx:abap>
</abapGit>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class zcl_text2tab_parser definition
constants c_crlf like cl_abap_char_utilities=>cr_lf value cl_abap_char_utilities=>cr_lf. "#EC NOTEXT
constants c_lf like cl_abap_char_utilities=>newline value cl_abap_char_utilities=>newline. "#EC NOTEXT

class-methods version
returning
value(r_version) type string .
class-methods check_version_fits
importing
!i_required_version type string
Expand Down Expand Up @@ -220,7 +223,7 @@ CLASS ZCL_TEXT2TAB_PARSER IMPLEMENTATION.
method check_version_fits.

r_fits = zcl_text2tab_utils=>check_version_fits(
i_current_version = zif_text2tab_constants=>version
i_current_version = zif_text2tab=>version
i_required_version = i_required_version ).

endmethod.
Expand Down Expand Up @@ -983,4 +986,9 @@ CLASS ZCL_TEXT2TAB_PARSER IMPLEMENTATION.
location = l_location.

endmethod.


method version.
r_version = zif_text2tab=>version.
endmethod.
ENDCLASS.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions src/core/zif_text2tab.intf.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
interface zif_text2tab
public.

types ty_begin_comment type c length 1.

constants c_auto_detect_by_space type ty_begin_comment value cl_abap_char_utilities=>maxchar.

constants version type string value 'v2.4.0'. "#EC NOTEXT
constants origin type string value 'https://github.com/sbcgua/text2tab'. "#EC NOTEXT
constants license type string value 'MIT'. "#EC NOTEXT

endinterface.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions src/examples/package.devc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DEVC" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DEVC>
<CTEXT>TEXT2TAB serializer/deserializer: Examples</CTEXT>
</DEVC>
</asx:values>
</asx:abap>
</abapGit>
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ form main
if zcl_text2tab_parser=>check_version_fits( lv_required_text2tab_ver ) = abap_false.
write: / 'Error: text2tab version is lower than required' color 6. "#EC NOTEXT
write: / 'Required is:', lv_required_text2tab_ver. "#EC NOTEXT
write: / 'Installed is:', zif_text2tab_constants=>version. "#EC NOTEXT
write: / 'Installed is:', zif_text2tab=>version. "#EC NOTEXT
write: / 'Please upgrade text2tab'. "#EC NOTEXT
return.
endif.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 0 additions & 8 deletions src/zif_text2tab.intf.abap

This file was deleted.

6 changes: 0 additions & 6 deletions src/zif_text2tab_constants.intf.abap

This file was deleted.

15 changes: 0 additions & 15 deletions src/zif_text2tab_constants.intf.xml

This file was deleted.

0 comments on commit 71791d3

Please sign in to comment.