Skip to content

Commit

Permalink
Merge pull request unidoc#439 from unidoc-build/prep-rc-v1.6.0
Browse files Browse the repository at this point in the history
Prepare UniOffice release v1.6.0
  • Loading branch information
gunnsth authored Oct 13, 2020
2 parents ec21603 + c682343 commit 35b6f98
Show file tree
Hide file tree
Showing 47 changed files with 18,737 additions and 18,655 deletions.
4 changes: 2 additions & 2 deletions algo/algo.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package algo ;import _b "strconv";func _e (_g byte )bool {return _g >='0'&&_g <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_dd :=make ([]byte ,len (s )*cnt );_gd :=[]byte (s );for _f :=0;_f < cnt ;_f ++{copy (_dd [_f :],_gd );};return string (_dd );};
package algo ;import _f "strconv";

// NaturalLess compares two strings in a human manner so rId2 sorts less than rId10
func NaturalLess (lhs ,rhs string )bool {_a ,_bf :=0,0;for _a < len (lhs )&&_bf < len (rhs ){_c :=lhs [_a ];_bd :=rhs [_bf ];_df :=_e (_c );_ag :=_e (_bd );switch {case _df &&!_ag :return true ;case !_df &&_ag :return false ;case !_df &&!_ag :if _c !=_bd {return _c < _bd ;};_a ++;_bf ++;default:_ea :=_a +1;_af :=_bf +1;for _ea < len (lhs )&&_e (lhs [_ea ]){_ea ++;};for _af < len (rhs )&&_e (rhs [_af ]){_af ++;};_gc ,_ :=_b .ParseUint (lhs [_a :_ea ],10,64);_da ,_ :=_b .ParseUint (rhs [_a :_af ],10,64);if _gc !=_da {return _gc < _da ;};_a =_ea ;_bf =_af ;};};return len (lhs )< len (rhs );};
func NaturalLess (lhs ,rhs string )bool {_ff ,_a :=0,0;for _ff < len (lhs )&&_a < len (rhs ){_ad :=lhs [_ff ];_ba :=rhs [_a ];_af :=_d (_ad );_fb :=_d (_ba );switch {case _af &&!_fb :return true ;case !_af &&_fb :return false ;case !_af &&!_fb :if _ad !=_ba {return _ad < _ba ;};_ff ++;_a ++;default:_bf :=_ff +1;_df :=_a +1;for _bf < len (lhs )&&_d (lhs [_bf ]){_bf ++;};for _df < len (rhs )&&_d (rhs [_df ]){_df ++;};_g ,_ :=_f .ParseUint (lhs [_ff :_bf ],10,64);_gb ,_ :=_f .ParseUint (rhs [_ff :_df ],10,64);if _g !=_gb {return _g < _gb ;};_ff =_bf ;_a =_df ;};};return len (lhs )< len (rhs );};func _d (_fe byte )bool {return _fe >='0'&&_fe <='9'};func RepeatString (s string ,cnt int )string {if cnt <=0{return "";};_dd :=make ([]byte ,len (s )*cnt );_bb :=[]byte (s );for _c :=0;_c < cnt ;_c ++{copy (_dd [_c :],_bb );};return string (_dd );};
668 changes: 334 additions & 334 deletions chart/chart.go

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions color/color.go

Large diffs are not rendered by default.

475 changes: 263 additions & 212 deletions common/common.go

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions common/license/license.go

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions common/tempstorage/diskstore/diskstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@

// Package diskstore implements tempStorage interface
// by using disk as a storage
package diskstore ;import (_f "github.com/unidoc/unioffice/common/tempstorage";_c "io/ioutil";_eb "os";_e "strings";);

// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_bb :=diskStorage {};_f .SetAsStorage (&_bb )};
package diskstore ;import (_g "github.com/unidoc/unioffice/common/tempstorage";_d "io/ioutil";_a "os";_c "strings";);

// Add is not applicable in the diskstore implementation
func (_ff diskStorage )Add (path string )error {return nil };type diskStorage struct{};

// Open opens file from disk according to a path
func (_g diskStorage )Open (path string )(_f .File ,error ){return _eb .Open (path )};
func (_ac diskStorage )Add (path string )error {return nil };

// RemoveAll removes all files in the directory
func (_da diskStorage )RemoveAll (dir string )error {if _e .HasPrefix (dir ,_eb .TempDir ()){return _eb .RemoveAll (dir );};return nil ;};
// TempFile creates a new temp file by calling ioutil TempFile
func (_dd diskStorage )TempFile (dir ,pattern string )(_g .File ,error ){return _d .TempFile (dir ,pattern );};

// TempFile creates a new temp directory by calling ioutil TempDir
func (_d diskStorage )TempDir (pattern string )(string ,error ){return _c .TempDir ("",pattern )};
func (_ag diskStorage )TempDir (pattern string )(string ,error ){return _d .TempDir ("",pattern )};

// TempFile creates a new temp file by calling ioutil TempFile
func (_fg diskStorage )TempFile (dir ,pattern string )(_f .File ,error ){return _c .TempFile (dir ,pattern );};
// SetAsStorage sets temp storage as a disk storage
func SetAsStorage (){_gg :=diskStorage {};_g .SetAsStorage (&_gg )};type diskStorage struct{};

// RemoveAll removes all files in the directory
func (_gd diskStorage )RemoveAll (dir string )error {if _c .HasPrefix (dir ,_a .TempDir ()){return _a .RemoveAll (dir );};return nil ;};

// Open opens file from disk according to a path
func (_b diskStorage )Open (path string )(_g .File ,error ){return _a .Open (path )};
38 changes: 19 additions & 19 deletions common/tempstorage/memstore/memstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@

// Package memstore implements tempStorage interface
// by using memory as a storage
package memstore ;import (_f "encoding/hex";_dg "errors";_de "fmt";_fb "github.com/unidoc/unioffice/common/tempstorage";_c "io";_b "io/ioutil";_cf "math/rand";_d "sync";);
package memstore ;import (_a "encoding/hex";_fd "errors";_gd "fmt";_ca "github.com/unidoc/unioffice/common/tempstorage";_g "io";_bd "io/ioutil";_f "math/rand";_b "sync";);func _df (_ea int )(string ,error ){_ggf :=make ([]byte ,_ea );if _ ,_gb :=_f .Read (_ggf );_gb !=nil {return "",_gb ;};return _a .EncodeToString (_ggf ),nil ;};type memFile struct{_ga *memDataCell ;_ba int64 ;};

// Name returns the filename of the underlying memDataCell
func (_bgg *memFile )Name ()string {return _bgg ._ga ._bab };

// Close is not applicable in this implementation
func (_ee *memFile )Close ()error {return nil };type memStorage struct{_ae _b .Map };

// Write writes to the end of the underlying memDataCell in order to implement Writer interface
func (_da *memFile )Write (p []byte )(int ,error ){_da ._df ._fef =append (_da ._df ._fef ,p ...);_da ._df ._feg +=int64 (len (p ));return len (p ),nil ;};type memStorage struct{_ac _d .Map };func _eb (_eg string )string {_bc ,_ :=_efc (6);return _eg +_bc };
func (_bga *memFile )Write (p []byte )(int ,error ){_bga ._ga ._ace =append (_bga ._ga ._ace ,p ...);_bga ._ga ._cb +=int64 (len (p ));return len (p ),nil ;};

// SetAsStorage sets temp storage as a memory storage
func SetAsStorage (){_be :=memStorage {_ac :_d .Map {}};_fb .SetAsStorage (&_be )};
func SetAsStorage (){_cbd :=memStorage {_ae :_b .Map {}};_ca .SetAsStorage (&_cbd )};

// RemoveAll removes all files according to the dir argument prefix
func (_bf *memStorage )RemoveAll (dir string )error {_bf ._ac .Range (func (_bfd ,_gfd interface{})bool {_bf ._ac .Delete (_bfd );return true });return nil ;};

// Name returns the filename of the underlying memDataCell
func (_a *memFile )Name ()string {return _a ._df ._dfb };
// TempFile creates a new empty file in the storage and returns it
func (_baa *memStorage )TempFile (dir ,pattern string )(_ca .File ,error ){_dad :=dir +"\u002f"+_dea (pattern );_af :=&memDataCell {_bab :_dad ,_ace :[]byte {}};_bae :=&memFile {_ga :_af };_baa ._ae .Store (_dad ,_af );return _bae ,nil ;};

// TempDir creates a name for a new temp directory using a pattern argument
func (_eed *memStorage )TempDir (pattern string )(string ,error ){return _eb (pattern ),nil };type memFile struct{_df *memDataCell ;_gf int64 ;};func _efc (_efd int )(string ,error ){_gfb :=make ([]byte ,_efd );if _ ,_gd :=_cf .Read (_gfb );_gd !=nil {return "",_gd ;};return _f .EncodeToString (_gfb ),nil ;};

// Read reads from the underlying memDataCell in order to implement Reader interface
func (_bg *memFile )Read (p []byte )(int ,error ){_ga :=_bg ._gf ;_fe :=_bg ._df ._feg ;_cb :=int64 (len (p ));if _cb > _fe {_cb =_fe ;p =p [:_cb ];};if _ga >=_fe {return 0,_c .EOF ;};_e :=_ga +_cb ;if _e >=_fe {_e =_fe ;};_gfe :=copy (p ,_bg ._df ._fef [_ga :_e ]);_bg ._gf =_e ;return _gfe ,nil ;};

// Close is not applicable in this implementation
func (_ef *memFile )Close ()error {return nil };
func (_gg *memStorage )TempDir (pattern string )(string ,error ){return _dea (pattern ),nil };type memDataCell struct{_bab string ;_ace []byte ;_cb int64 ;};

// Add reads a file from a disk and adds it to the storage
func (_fd *memStorage )Add (path string )error {_ge ,_agb :=_b .ReadFile (path );if _agb !=nil {return _agb ;};_fd ._ac .Store (path ,&memDataCell {_dfb :path ,_fef :_ge });return nil ;};
func (_fde *memStorage )Add (path string )error {_bc ,_eec :=_bd .ReadFile (path );if _eec !=nil {return _eec ;};_fde ._ae .Store (path ,&memDataCell {_bab :path ,_ace :_bc });return nil ;};func _dea (_dec string )string {_ff ,_ :=_df (6);return _dec +_ff };

// TempFile creates a new empty file in the storage and returns it
func (_cc *memStorage )TempFile (dir ,pattern string )(_fb .File ,error ){_gc :=dir +"\u002f"+_eb (pattern );_fege :=&memDataCell {_dfb :_gc ,_fef :[]byte {}};_beg :=&memFile {_df :_fege };_cc ._ac .Store (_gc ,_fege );return _beg ,nil ;};
// Read reads from the underlying memDataCell in order to implement Reader interface
func (_ac *memFile )Read (p []byte )(int ,error ){_d :=_ac ._ba ;_bg :=_ac ._ga ._cb ;_e :=int64 (len (p ));if _e > _bg {_e =_bg ;p =p [:_e ];};if _d >=_bg {return 0,_g .EOF ;};_bad :=_d +_e ;if _bad >=_bg {_bad =_bg ;};_ed :=copy (p ,_ac ._ga ._ace [_d :_bad ]);_ac ._ba =_bad ;return _ed ,nil ;};

// RemoveAll removes all files according to the dir argument prefix
func (_gac *memStorage )RemoveAll (dir string )error {_gac ._ae .Range (func (_fb ,_de interface{})bool {_gac ._ae .Delete (_fb );return true });return nil ;};

// Open returns tempstorage File object by name
func (_cd *memStorage )Open (path string )(_fb .File ,error ){_ee ,_ag :=_cd ._ac .Load (path );if !_ag {return nil ,_dg .New (_de .Sprintf ("\u0043\u0061\u006eno\u0074\u0020\u006f\u0070\u0065\u006e\u0020\u0074\u0068\u0065\u0020\u0066\u0069\u006c\u0065\u0020\u0025\u0073",path ));};return &memFile {_df :_ee .(*memDataCell )},nil ;};type memDataCell struct{_dfb string ;_fef []byte ;_feg int64 ;};
func (_baf *memStorage )Open (path string )(_ca .File ,error ){_da ,_bdb :=_baf ._ae .Load (path );if !_bdb {return nil ,_fd .New (_gd .Sprintf ("\u0043\u0061\u006eno\u0074\u0020\u006f\u0070\u0065\u006e\u0020\u0074\u0068\u0065\u0020\u0066\u0069\u006c\u0065\u0020\u0025\u0073",path ));};return &memFile {_ga :_da .(*memDataCell )},nil ;};
22 changes: 11 additions & 11 deletions common/tempstorage/tempstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package tempstorage ;import _cg "io";type storage interface{Open (_b string )(File ,error );TempFile (_f ,_bg string )(File ,error );TempDir (_a string )(string ,error );RemoveAll (_e string )error ;Add (_g string )error ;};var _eg storage ;
package tempstorage ;import _a "io";

// Open returns tempstorage File object by name.
func Open (path string )(File ,error ){return _eg .Open (path )};
func Open (path string )(File ,error ){return _b .Open (path )};type storage interface{Open (_gg string )(File ,error );TempFile (_ga ,_d string )(File ,error );TempDir (_da string )(string ,error );RemoveAll (_gc string )error ;Add (_f string )error ;};

// Add reads a file from a disk and adds it to the storage.
func Add (path string )error {return _eg .Add (path )};

// TempDir creates a name for a new temp directory using a pattern argument.
func TempDir (pattern string )(string ,error ){return _eg .TempDir (pattern )};
func Add (path string )error {return _b .Add (path )};

// File is a representation of a storage file
// with Read, Write, Close and Name methods identical to os.File.
type File interface{_cg .Reader ;_cg .Writer ;_cg .Closer ;Name ()string ;};
type File interface{_a .Reader ;_a .Writer ;_a .Closer ;Name ()string ;};

// TempFile creates new empty file in the storage and returns it.
func TempFile (dir ,pattern string )(File ,error ){return _eg .TempFile (dir ,pattern )};
func TempFile (dir ,pattern string )(File ,error ){return _b .TempFile (dir ,pattern )};

// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _eg .RemoveAll (dir )};
// TempDir creates a name for a new temp directory using a pattern argument.
func TempDir (pattern string )(string ,error ){return _b .TempDir (pattern )};

// SetAsStorage changes temporary storage to newStorage.
func SetAsStorage (newStorage storage ){_eg =newStorage };
func SetAsStorage (newStorage storage ){_b =newStorage };var _b storage ;

// RemoveAll removes all files according to the dir argument prefix.
func RemoveAll (dir string )error {return _b .RemoveAll (dir )};
Loading

0 comments on commit 35b6f98

Please sign in to comment.