--[[----------------------------------------------------------------------------

WFSortOrderStrings.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2013 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

	-- WF.core.strings
local WFSortOrderStringsImp = require 'WFSortOrderStringsImp'

	-- WF.core.utils
local WFArguments = require 'WFArguments'


--------------------------------------------------------------------------------

local check = assert( WFArguments.check )


--============================================================================--

-- @mark WFSortOrderStrings namespace

local WFSortOrderStrings = {}

WFSortOrderStrings.MIDPOINT = 'Uzzz'

--------------------------------------------------------------------------------
--[[!
	\brief Create a sort order encoding used by the insertion routines.
	
	\param encoding (string) character set to be used in encoding

	\return (userdata) a sort order encoding object used by the insertion routines
		in this namespace
]]--

function WFSortOrderStrings.makeEncoding( encoding )

	check( '+string' )
	
	return WFSortOrderStringsImp.makeEncoding( encoding )
	
end

--------------------------------------------------------------------------------

local lex64Encoding = WFSortOrderStringsImp.makeEncoding
	'-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between the beginning of the encoding range
		and \c right.
]]--

function WFSortOrderStrings.insertBefore( encodingObj, right, optBias )

	check( 'userdata', '+string', '?string' )
	
	return WFSortOrderStringsImp.insertBefore( encodingObj, right, optBias )

end

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between the beginning of the encoding range
		and \c right using lex64 encoding.
]]--

function WFSortOrderStrings.insertBefore_lex64( right, optBias )

	check( '+string', '?string' )
	
	return WFSortOrderStringsImp.insertBefore( lex64Encoding, right, optBias )

end

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between \c left and the end of the
		encoding range.
]]--

function WFSortOrderStrings.insertAfter( encodingObj, left, optBias )

	check( 'userdata', 'string', '?string' )
	
	return WFSortOrderStringsImp.insertAfter( encodingObj, left, optBias )

end

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between \c left and the end of the encoding
		range using lex64 encoding.
]]--

function WFSortOrderStrings.insertAfter_lex64( left, optBias )

	check( 'string', '?string' )
	
	return WFSortOrderStringsImp.insertAfter( lex64Encoding, left, optBias )

end

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between \c left and \c right.
]]--

function WFSortOrderStrings.insertBetween( encodingObj, left, right, optBias )

	check( 'userdata', 'string', '+string', '?string' )
	
	return WFSortOrderStringsImp.insertBetween( encodingObj, left, right, optBias )

end

--------------------------------------------------------------------------------
--[[!
	\brief Construct a string lying between \c left and \c right using
		lex64 encoding.
]]--

function WFSortOrderStrings.insertBetween_lex64( left, right, optBias )

	check( 'string', '+string', '?string' )
	
	return WFSortOrderStringsImp.insertBetween( lex64Encoding, left, right, optBias )

end

--------------------------------------------------------------------------------

return WFSortOrderStrings
