Doubled geometry and T-folds